|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object edu.umd.cfar.lamp.viper.geometry.Util
A set of utility static methods for dealing with the viper geometry package.
Constructor Summary | |
Util()
|
Method Summary | |
static Rational |
areaSign(Component a,
Component b,
Component c)
Calculates a minus b cross a minus c, or (a-b)x(a-c) |
static boolean |
collinear(Pnt a,
Pnt b,
Pnt c)
Checks to see if three points are collinear. |
static boolean |
collinearAndOverlap(Pnt a,
Pnt b,
Pnt c,
Pnt d)
Tests to see if two line segments are collinear and overlap. |
static double |
euclideanDistance(Pnt a,
Pnt b)
Computes the 2-norm of the distance between two points. |
static char |
lineIntersection(Pnt a,
Pnt b,
Pnt c,
Pnt d,
Pnt p)
Sets point p to the intersection of segments ab and cd. |
static Rational |
manhattanDistance(Pnt a,
Pnt b)
Computes the 1-norm of the distance between two points. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public Util()
Method Detail |
public static char lineIntersection(Pnt a, Pnt b, Pnt c, Pnt d, Pnt p)
a
- endpoint of the first lineb
- endpoint of the first linec
- endpoint of the second lined
- endpoint of the second linep
- the point that will be modified to refer to the point of
intersection. It is only modified if the two lines intersect.
public static boolean collinearAndOverlap(Pnt a, Pnt b, Pnt c, Pnt d)
a
- endpoint of the first lineb
- endpoint of the first linec
- endpoint of the second lined
- endpoint of the second line
true
iff the segments ab and cd share at least one
point and are collinear.public static boolean collinear(Pnt a, Pnt b, Pnt c)
a
- point to checkb
- point to checkc
- point to check
true
iff the three points lie on the same line.public static Rational areaSign(Component a, Component b, Component c)
(a-b)x(a-c).
By the right hand rule, this returns positive values when a is to the
left of bc and negative when it is to the right. The absolute value is
the area of the parallelogram with points a, b, and c.
- Parameters:
a
- The origin of the parallelogramb
- The second point on the linec
- The third point.
- Returns:
- negative value if the three points are oriented clockwise,
positive if CCW, and 0 if collinear.
public static Rational manhattanDistance(Pnt a, Pnt b)
a
- A pointb
- A point
public static double euclideanDistance(Pnt a, Pnt b)
a
- A pointb
- A point
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |