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

Bug 384111

Summary: [GEF4] Point.getConvexHull(Point...) throws ArithmeticException for duplicate points
Product: [Tools] GEF Reporter: Matthias Wienand <matthias.wienand>
Component: GEF GeometryAssignee: Matthias Wienand <matthias.wienand>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: matthias.wienand, nyssen
Version: unspecified   
Target Milestone: ---   
Hardware: All   
OS: All   
Whiteboard:
Attachments:
Description Flags
Fixes the getConvexHull() bug none

Description Matthias Wienand CLA 2012-07-03 04:02:27 EDT
Build Identifier: 

The Point.getConvexHull(Point...) method throws an ArithmeticException if some of the points given to it are identical. This is the case, because the list of points is sorted by their angle to the start point. If the start point is identical to another point in the list, the related vector is (0, 0) so that the comparison with another vector throws an ArithmeticException.

Reproducible: Always

Steps to Reproduce:
Point.getConvexHull(new Point(), new Point(), new Point(1,1), new Point(1,2));
Comment 1 Matthias Wienand CLA 2012-07-03 06:06:09 EDT
Created attachment 218202 [details]
Fixes the getConvexHull() bug

Patches the Point.java file to remove duplicate points from the list of points given to the getConvexHull() method before applying the Graham scan.
Comment 2 Matthias Wienand CLA 2012-07-19 05:31:04 EDT
Ensure Point#getConvexHull() is robust against duplicate points. Pushed changes to master. Resolving as FIXED.