jdsl.geomobj.ref
Class GeomTester2DImpl
java.lang.Object
|
+--jdsl.geomobj.ref.GeomTester2DImpl
- All Implemented Interfaces:
- GeomTester2D, ThreeArgsGeomTests2D, TwoArgsGeomTests2D
- public class GeomTester2DImpl
- extends java.lang.Object
- implements GeomTester2D
Default implementation of the GeomTester2D interface.
Currently all the methods using VoronoiLinearCurve2D,
IntVoronoiLine2D, IntVoronoiPoint2D, IntVoronoiRay2D, and
IntVoronoiSegment2D are commented out; they will be reinserted
later.
- Version:
- $Id: GeomTester2DImpl.java,v 1.6 2002/03/05 12:35:26 lv Exp $
- Author:
- Masi Oka (mao), Luca Vismara (lv)
Fields inherited from interface jdsl.geomobj.api.GeomTester2D |
ABOVE, BELOW, COLLINEAR, EQUAL, GREATER, INSIDE, LEFT, LEFT_TURN, LESSER, MULTIPLE, NEGATIVE, NO, ON, OUTSIDE, POSITIVE, RIGHT, RIGHT_TURN, SINGLE, X_ALIGNED, Y_ALIGNED |
Method Summary |
int |
aboveBelow(Point2D q,
LinearCurve2D lc)
|
int |
aboveBelow(Point2D q,
Point2D p)
|
boolean |
areEqual(Point2D q1,
Point2D q2)
|
int |
compareDistances(Point2D q,
Point2D p1,
Point2D p2)
|
int |
compareSlopes(LinearCurve2D lc1,
LinearCurve2D lc2)
|
int |
insideOutside(Point2D q,
Circle2D c)
|
int |
insideOutside(Point2D q,
Rectangle2D r)
|
protected int |
intersection(Line2D l1,
Line2D l2)
|
protected int |
intersection(Line2D l,
Ray2D r)
|
protected int |
intersection(Line2D l,
Segment2D s)
|
int |
intersection(LinearCurve2D lc1,
LinearCurve2D lc2)
Tests if two linear curves intersect. |
protected int |
intersection(Ray2D r1,
Ray2D r2)
|
protected int |
intersection(Ray2D r,
Segment2D s)
|
protected int |
intersection(Segment2D s1,
Segment2D s2)
|
int |
leftRight(Point2D q,
LinearCurve2D lc)
|
int |
leftRight(Point2D q,
Point2D p)
|
int |
leftRightTurn(Point2D p1,
Point2D q,
Point2D p2)
|
boolean |
withinHorizontalSpan(Point2D q,
LinearCurve2D lc)
|
boolean |
withinVerticalSpan(Point2D q,
LinearCurve2D lc)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
GeomTester2DImpl
public GeomTester2DImpl()
areEqual
public boolean areEqual(Point2D q1,
Point2D q2)
- Specified by:
areEqual
in interface GeomTester2D
- Following copied from interface:
jdsl.geomobj.api.GeomTester2D
- Parameters:
q1
- a pointq2
- a point- Returns:
- whether q1 and q2 are the same point
aboveBelow
public int aboveBelow(Point2D q,
Point2D p)
throws InvalidPointException
- Specified by:
aboveBelow
in interface TwoArgsGeomTests2D
- Following copied from interface:
jdsl.geomobj.api.TwoArgsGeomTests2D
- Parameters:
q
- a pointp
- a point- Returns:
- whether q is GeomTester2D.ABOVE, GeomTester2D.Y_ALIGNED,
or GeomTester2D.BELOW p
- Throws:
InvalidPointException
- if either p or q is
Point2D.INFINITE
aboveBelow
public int aboveBelow(Point2D q,
LinearCurve2D lc)
throws InvalidPointException,
InvalidLinearCurveException,
InvalidGeomTestException
- Specified by:
aboveBelow
in interface GeomTester2D
- Following copied from interface:
jdsl.geomobj.api.GeomTester2D
- Parameters:
q
- a pointlc
- a linear curve- Returns:
- whether q is GeomTester2D.ABOVE, GeomTester2D.ON, or
GeomTester2D.BELOW lc
- Throws:
InvalidPointException
- if q is Point2D.INFINITEInvalidGeomTestException
- if q is not within the horizontal
span of lc
leftRight
public int leftRight(Point2D q,
Point2D p)
throws InvalidPointException
- Specified by:
leftRight
in interface TwoArgsGeomTests2D
- Following copied from interface:
jdsl.geomobj.api.TwoArgsGeomTests2D
- Parameters:
q
- a pointp
- a point- Returns:
- whether q is to the GeomTester2D.LEFT,
GeomTester2D.X_ALIGNED, or to the GeomTester2D.RIGHT of p
- Throws:
InvalidPointException
- if either p or q is
Point2D.INFINITE
leftRight
public int leftRight(Point2D q,
LinearCurve2D lc)
throws InvalidPointException,
InvalidLinearCurveException,
InvalidGeomTestException
- Specified by:
leftRight
in interface GeomTester2D
- Following copied from interface:
jdsl.geomobj.api.GeomTester2D
- Parameters:
q
- a pointlc
- a line- Returns:
- whether q is to the GeomTester2D.LEFT, GeomTester2D.ON, or
to the GeomTester2D.RIGHT of lc
- Throws:
InvalidPointException
- if q is Point2D.INFINITEInvalidGeomTestException
- if q is not within the vertical
span of lc
leftRightTurn
public int leftRightTurn(Point2D p1,
Point2D q,
Point2D p2)
throws InvalidPointException
- Specified by:
leftRightTurn
in interface ThreeArgsGeomTests2D
- Following copied from interface:
jdsl.geomobj.api.ThreeArgsGeomTests2D
- Parameters:
p1
- a pointq
- a pointp2
- a point- Returns:
- whether (p1,q,p2) form a GeomTester2D.LEFT_TURN, are
GeomTester2D.COLLINEAR, or form a GeomTester2D.RIGHT_TURN
- Throws:
InvalidPointException
- if either p1, or q, or p2 is
Point2D.INFINITE
withinHorizontalSpan
public boolean withinHorizontalSpan(Point2D q,
LinearCurve2D lc)
throws InvalidPointException,
InvalidLinearCurveException
- Specified by:
withinHorizontalSpan
in interface GeomTester2D
- Following copied from interface:
jdsl.geomobj.api.GeomTester2D
- Parameters:
q
- a pointlc
- a linear curve- Returns:
- whether q is within the horizontal span of lc
- Throws:
InvalidPointException
- if q is Point2D.INFINITE
withinVerticalSpan
public boolean withinVerticalSpan(Point2D q,
LinearCurve2D lc)
throws InvalidPointException,
InvalidLinearCurveException
- Specified by:
withinVerticalSpan
in interface GeomTester2D
- Following copied from interface:
jdsl.geomobj.api.GeomTester2D
- Parameters:
q
- a pointlc
- a linear curve- Returns:
- whether q is within the vertical span of lc
- Throws:
InvalidPointException
- if q is Point2D.INFINITE
compareDistances
public int compareDistances(Point2D q,
Point2D p1,
Point2D p2)
throws InvalidPointException
- Specified by:
compareDistances
in interface ThreeArgsGeomTests2D
- Following copied from interface:
jdsl.geomobj.api.ThreeArgsGeomTests2D
- Parameters:
q
- a pointp1
- a pointp2
- a point- Returns:
- whether the distance between q and p1 is
GeomTester2D.LESSER than, GeomTester2D.EQUAL to, or
GeomTester2D.GREATER than the distance between q and p2
- Throws:
InvalidPointException
- if q is Point2D.INFINITE
compareSlopes
public int compareSlopes(LinearCurve2D lc1,
LinearCurve2D lc2)
throws InvalidLinearCurveException
- Specified by:
compareSlopes
in interface TwoArgsGeomTests2D
- Following copied from interface:
jdsl.geomobj.api.TwoArgsGeomTests2D
- Parameters:
lc1
- a linear curvelc2
- a linear curve- Returns:
- whether lc1 has a GeomTester2D.LESSER, GeomTester2D.EQUAL, or
GeomTester2D.GREATER slope than lc2
intersection
public int intersection(LinearCurve2D lc1,
LinearCurve2D lc2)
throws InvalidLinearCurveException
- Description copied from interface:
GeomTester2D
- Tests if two linear curves intersect.
- Specified by:
intersection
in interface GeomTester2D
- Following copied from interface:
jdsl.geomobj.api.GeomTester2D
- Parameters:
lc1
- a linear curvelc2
- a linear curve- Returns:
- GeomTester2D.NO if lc1 does not intersect lc2,
GeomTester2D.SINGLE if lc1 intersects lc2 in one point, and
GeomTester2D.MULTIPLE if lc1 and lc2 (partially) overlap
insideOutside
public int insideOutside(Point2D q,
Circle2D c)
throws InvalidPointException,
InvalidCircleException
- Specified by:
insideOutside
in interface TwoArgsGeomTests2D
- Following copied from interface:
jdsl.geomobj.api.TwoArgsGeomTests2D
- Parameters:
q
- a pointc
- a circle- Returns:
- whether q is GeomTester2D.INSIDE, GeomTester2D.ON, or
GeomTester2D.OUTSIDE c
- Throws:
InvalidPointException
- if q is Point2D.INFINITE
insideOutside
public int insideOutside(Point2D q,
Rectangle2D r)
throws InvalidPointException
- Specified by:
insideOutside
in interface GeomTester2D
- Following copied from interface:
jdsl.geomobj.api.GeomTester2D
- Parameters:
q
- a pointr
- a rectangle- Returns:
- whether q is GeomTester2D.INSIDE, GeomTester2D.ON, or
GeomTester2D.OUTSIDE r
- Throws:
InvalidPointException
- if q is Point2D.INFINITE
intersection
protected int intersection(Line2D l1,
Line2D l2)
intersection
protected int intersection(Line2D l,
Ray2D r)
intersection
protected int intersection(Line2D l,
Segment2D s)
intersection
protected int intersection(Ray2D r1,
Ray2D r2)
intersection
protected int intersection(Ray2D r,
Segment2D s)
intersection
protected int intersection(Segment2D s1,
Segment2D s2)