|
org.eclipse.draw2d.geometry
Class Geometry
java.lang.Object
org.eclipse.draw2d.geometry.Geometry
- public class Geometry
- extends java.lang.Object
A Utilities class for geometry operations.
-
Since:
- 3.1
Method Summary
|
static boolean
|
linesIntersect
(int ux,
int uy,
int vx,
int vy,
int sx,
int sy,
int tx,
int ty)
Determines whether the two line segments formed by the given coordinates intersect. |
static boolean
|
polygonContainsPoint
(
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 boolean
|
polylineContainsPoint
(
PointList points,
int x,
int y,
int tolerance)
|
Methods inherited from class java.lang.Object
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
|
Geometry
public Geometry()
linesIntersect
public static boolean linesIntersect(int ux,
int uy,
int vx,
int vy,
int sx,
int sy,
int tx,
int ty)
- Determines whether the two line segments formed by the given coordinates intersect. If
one of the two line segments starts or ends on the other line, then they are considered
to be intersecting.
-
-
Parameters:
-
ux - x coordinate of starting point of line 1 -
uy - y coordinate of starting point of line 1 -
vx - x coordinate of ending point of line 1 -
vy - y coordinate of endpoing point of line 1 -
sx - x coordinate of the starting point of line 2 -
sy - y coordinate of the starting point of line 2 -
tx - x coordinate of the ending point of line 2 -
ty - y coordinate of the ending point of line 2
-
Returns:
-
true if the two line segments formed by the given coordinates
cross -
Since:
- 3.1
polylineContainsPoint
public static boolean polylineContainsPoint(
PointList points,
int x,
int y,
int tolerance)
-
-
Since:
- 3.5
-
See Also:
-
PointList.polylineContainsPoint(int, int, int)
polygonContainsPoint
public static boolean polygonContainsPoint(
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. 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:
-
PointList.polygonContainsPoint(int, int)
Copyright (c) IBM Corp. and others 2000, 2007. All Rights Reserved.
|
|