|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--y.geom.Geom
This class provides useful geometric primitives and advanced geometric algorithms.
This class is intended to provide static methods for geometric
calculations. It can be compared to the class java.lang.Math
which provides methods for general mathematic calculations.
Method Summary | |
static YList |
calcConvexHull(YList points)
Calculates the convex hull for a set of points. |
static boolean |
collinear(YPoint p,
YPoint q,
YPoint r)
Returns true iff the given points are colinear, i.e. all
three points lie on a common line.
|
static boolean |
leftTurn(YPoint p,
YPoint q,
YPoint r)
Same as orientation(p,q,r) > 0 |
static int |
orientation(double px,
double py,
double qx,
double qy,
double rx,
double ry)
Same as #orientation(YPoint, YPoint, YPoint) with double values as arguments. |
static int |
orientation(YPoint p,
YPoint q,
YPoint r)
Returns the orientation of point r relative to the directed
line from point p to point q .
|
static boolean |
rightTurn(YPoint p,
YPoint q,
YPoint r)
Same as orientation(p,q,r) < 0 |
static int |
sideOfCircle(YPoint a,
YPoint b,
YPoint c,
YPoint d)
Returns +1 if point d lies left of the directed circle through
points a , b , and c ,
0 if a,b,c |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
public static int orientation(YPoint p, YPoint q, YPoint r)
r
relative to the directed
line from point p
to point q
.
The given tuple of points is said to have positive orientation if
p
and q
are distinct and r
lies
to the left of the oriented line passing through p
and q
and oriented from p
to q
.
The tuple is said to have negative orientation if
p
and q
are distinct and r
lies
to the right of the line, and the tuple is said to have orientation zero
if the three points are colinear.
public static int orientation(double px, double py, double qx, double qy, double rx, double ry)
public static boolean leftTurn(YPoint p, YPoint q, YPoint r)
orientation(p,q,r) > 0
public static boolean rightTurn(YPoint p, YPoint q, YPoint r)
orientation(p,q,r) < 0
public static boolean collinear(YPoint p, YPoint q, YPoint r)
true
iff the given points are colinear, i.e. all
three points lie on a common line.
Same as orientation(p,q,r) == 0
public static int sideOfCircle(YPoint a, YPoint b, YPoint c, YPoint d)
d
lies left of the directed circle through
points a
, b
, and c
,
0 if a,b,c and d are cocircular, and -1 otherwise.
public static YList calcConvexHull(YList points)
Complexity: O(n)*log(n), n := points.size()
points
- a list of YPoint objects
x
coordinate.
If two such points exist then of these points the one with the smallest
y
coordinate is chosen as the first one.
|
© Copyright 2000-2003, yWorks GmbH. All rights reserved. 2003 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |