jdsl.geomobj.api
Interface GeomTester2D

All Superinterfaces:
ThreeArgsGeomTests2D, TwoArgsGeomTests2D
All Known Implementing Classes:
GeomTester2DImpl

public interface GeomTester2D
extends TwoArgsGeomTests2D, ThreeArgsGeomTests2D

A collection of geometric tests. The parameters of the methods are interfaces. Currently all the methods using VoronoiLinearCurve2D are commented out; they will be reinserted later.

Version:
$Id: GeomTester2D.java,v 1.4 2002/03/05 12:28:28 lv Exp $
Author:
Luca Vismara (lv)

Field Summary
static int ABOVE
           
static int BELOW
           
static int COLLINEAR
           
static int EQUAL
           
static int GREATER
           
static int INSIDE
           
static int LEFT
           
static int LEFT_TURN
           
static int LESSER
           
static int MULTIPLE
           
static int NEGATIVE
           
static int NO
           
static int ON
           
static int OUTSIDE
           
static int POSITIVE
           
static int RIGHT
           
static int RIGHT_TURN
           
static int SINGLE
           
static int X_ALIGNED
           
static int Y_ALIGNED
           
 
Method Summary
 int aboveBelow(Point2D q, LinearCurve2D lc)
           
 boolean areEqual(Point2D q1, Point2D q2)
           
 int insideOutside(Point2D q, Rectangle2D r)
           
 int intersection(LinearCurve2D lc1, LinearCurve2D lc2)
          Tests if two linear curves intersect.
 int leftRight(Point2D q, LinearCurve2D lc)
           
 boolean withinHorizontalSpan(Point2D q, LinearCurve2D lc)
           
 boolean withinVerticalSpan(Point2D q, LinearCurve2D lc)
           
 
Methods inherited from interface jdsl.geomobj.api.TwoArgsGeomTests2D
aboveBelow, compareSlopes, insideOutside, leftRight
 
Methods inherited from interface jdsl.geomobj.api.ThreeArgsGeomTests2D
compareDistances, leftRightTurn
 

Field Detail

NEGATIVE

public static final int NEGATIVE

ON

public static final int ON

POSITIVE

public static final int POSITIVE

LEFT

public static final int LEFT

X_ALIGNED

public static final int X_ALIGNED

RIGHT

public static final int RIGHT

BELOW

public static final int BELOW

Y_ALIGNED

public static final int Y_ALIGNED

ABOVE

public static final int ABOVE

INSIDE

public static final int INSIDE

OUTSIDE

public static final int OUTSIDE

LESSER

public static final int LESSER

EQUAL

public static final int EQUAL

GREATER

public static final int GREATER

RIGHT_TURN

public static final int RIGHT_TURN

COLLINEAR

public static final int COLLINEAR

LEFT_TURN

public static final int LEFT_TURN

NO

public static final int NO

SINGLE

public static final int SINGLE

MULTIPLE

public static final int MULTIPLE
Method Detail

areEqual

public boolean areEqual(Point2D q1,
                        Point2D q2)
Parameters:
q1 - a point
q2 - a point
Returns:
whether q1 and q2 are the same point

aboveBelow

public int aboveBelow(Point2D q,
                      LinearCurve2D lc)
               throws InvalidPointException,
                      InvalidGeomTestException
Parameters:
q - a point
lc - a linear curve
Returns:
whether q is GeomTester2D.ABOVE, GeomTester2D.ON, or GeomTester2D.BELOW lc
Throws:
InvalidPointException - if q is Point2D.INFINITE
InvalidGeomTestException - if q is not within the horizontal span of lc

leftRight

public int leftRight(Point2D q,
                     LinearCurve2D lc)
              throws InvalidPointException,
                     InvalidGeomTestException
Parameters:
q - a point
lc - 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.INFINITE
InvalidGeomTestException - if q is not within the vertical span of lc

withinHorizontalSpan

public boolean withinHorizontalSpan(Point2D q,
                                    LinearCurve2D lc)
                             throws InvalidPointException
Parameters:
q - a point
lc - 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
Parameters:
q - a point
lc - a linear curve
Returns:
whether q is within the vertical span of lc
Throws:
InvalidPointException - if q is Point2D.INFINITE

intersection

public int intersection(LinearCurve2D lc1,
                        LinearCurve2D lc2)
Tests if two linear curves intersect.
Parameters:
lc1 - a linear curve
lc2 - 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,
                         Rectangle2D r)
                  throws InvalidPointException
Parameters:
q - a point
r - a rectangle
Returns:
whether q is GeomTester2D.INSIDE, GeomTester2D.ON, or GeomTester2D.OUTSIDE r
Throws:
InvalidPointException - if q is Point2D.INFINITE