Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 488370

Summary: Remove getNearestIntersection() from ICurve and provide Point.nearest() instead.
Product: [Tools] GEF Reporter: Alexander Nyßen <nyssen>
Component: GEF GeometryAssignee: Alexander Nyßen <nyssen>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3    
Version: 0.2.0   
Target Milestone: 4.0.0 (Neon) M6   
Hardware: All   
OS: All   
Whiteboard:

Description Alexander Nyßen CLA 2016-02-24 05:03:17 EST
We currently provide a very special operation to determine the nearest intersection point between two curves with respect to a given reference point. We should remove that from ICurve and instead provide utility method to Point instead, so that nearest intersection point can easily be computed as follows (and the interface is not "polluted"): 

Point[] intersections = getIntersections(curve1, curve2);
if (intersections.length > 0) {
 // find nearest intersection point
 return Point.nearest(reference, intersections);
}
Comment 1 Alexander Nyßen CLA 2016-02-24 05:21:55 EST
Pushed the following changes to origin/master:

- Removed getNearestIntersection(ICurve, Point) from ICurve interface and all implementations.
- Removed static delegation method from CurveUtils.
- Added Point.nearest(Point, Point[]) as a replacement to compute nearest point from a set of given point.
- Adjusted test cases and ChopBoxAnchor accordingly.

Resolving as fixed in 4.0.0 M6.
Comment 2 Alexander Nyßen CLA 2016-02-24 05:32:30 EST
Ensured that Point.nearest(Point, Point[]) is safe against an empty candidates array. Thereby, the former functionality can now be achieved by:

Point.nearest(reference, getIntersections(c1, c2));

Leaving as resolved in 4.0.0 M6.