Package org.eclipse.draw2d.geometry
Class Geometry
java.lang.Object
org.eclipse.draw2d.geometry.Geometry
A Utilities class for geometry operations.
- Since:
- 3.1
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionstatic booleanlinesIntersect(int x1, int y1, int x2, int y2, int x3, int y3, int x4, int y4) Determines whether the two line segments p1->p2 and p3->p4, given by p1=(x1, y1), p2=(x2,y2), p3=(x3,y3), p4=(x4,y4) intersect.static booleanpolygonContainsPoint(PointList points, int x, int y) One simple way of finding whether the point is inside or outside a simple polygon is to test how many times a ray starting from the point intersects the edges of the polygon.static booleanpolylineContainsPoint(PointList points, int x, int y, int tolerance) 
- 
Constructor Details- 
Geometrypublic Geometry()
 
- 
- 
Method Details- 
linesIntersectpublic static boolean linesIntersect(int x1, int y1, int x2, int y2, int x3, int y3, int x4, int y4) Determines whether the two line segments p1->p2 and p3->p4, given by p1=(x1, y1), p2=(x2,y2), p3=(x3,y3), p4=(x4,y4) intersect. Two line segments are regarded to be intersecting in case they share at least one common point, i.e if one of the two line segments starts or ends on the other line segment or the line segments are collinear and overlapping, then they are as well considered to be intersecting.- Parameters:
- x1- x coordinate of starting point of line segment 1
- y1- y coordinate of starting point of line segment 1
- x2- x coordinate of ending point of line segment 1
- y2- y coordinate of ending point of line segment 1
- x3- x coordinate of the starting point of line segment 2
- y3- y coordinate of the starting point of line segment 2
- x4- x coordinate of the ending point of line segment 2
- y4- y coordinate of the ending point of line segment 2
- Returns:
- trueif the two line segments formed by the given coordinates share at least one common point.
- Since:
- 3.1
 
- 
polylineContainsPoint- Since:
- 3.5
- See Also:
 
- 
polygonContainsPointOne simple way of finding whether the point is inside or outside a simple polygon is to test how many times a ray starting from the point intersects the edges of the polygon. If the point in question is not on the boundary of the polygon, the number of intersections is an even number if the point is outside, and it is odd if inside.- Since:
- 3.5
- See Also:
 
 
-