|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjwo.landserf.structure.Segment
Stores a directional 2d straight line segment. Can be used for geometric queries such as line intersection.
Field Summary | |
static int |
AHEAD
Indicates location aligned but in front of segment. |
static int |
BEHIND
Indicates location aligned but behind segment. |
static int |
INTERSECTS
Indicates location intersecting with segment. |
static int |
LEFT
Indicates location to the left of segment. |
static int |
RIGHT
Indicates location to the right of segment. |
static int |
SEPARATE
Indicates two segments are unconnected. |
static int |
UNDEFINED
Indicates location is undefined with respect to segment. |
Constructor Summary | |
Segment(float px1,
float py1,
float px2,
float py2)
Creates a line segment from the two given end points. |
Method Summary | |
float |
calcDistance(float px,
float py)
Reports the distance between the given point and this segment. |
int |
compare(float px,
float py)
Determines where the given point is in relation to the segment. |
int |
compare(Segment otherSegment)
Determines if and where the given segment intersects with this one. |
double |
getA()
Reports the 'a' coefficient of the cartesian equation of the segment. |
double |
getB()
Reports the 'b' coefficient of the cartesian equation of the segment. |
double |
getC()
Reports the 'c' coefficient of the cartesian equation of the segment. |
float |
getIntersectionX()
Reports the x coordinate of the intersection with last segment to be compared. |
float |
getIntersectionY()
Reports the y coordinate of the intersection with last segment to be compared. |
float |
getLength()
Reports the length of the segment. |
float |
getPx1()
Reports the x coordinate of the start point of the segment. |
float |
getPx2()
Reports the x coordinate of the end point of the segment. |
float |
getPy1()
Reports the y coordinate of the start point of the segment. |
float |
getPy2()
Reports the y coordinate of the end point of the segment. |
boolean |
intersectsEndpoint()
Reports whether intersection is with one of the segment's endpoints. |
boolean |
isUndefined()
Reports whether segment is undefined (endpoints identical). |
String |
toString()
Reports the coordinates of this segment. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
public static final int RIGHT
public static final int INTERSECTS
public static final int LEFT
public static final int AHEAD
public static final int BEHIND
public static final int SEPARATE
public static final int UNDEFINED
Constructor Detail |
public Segment(float px1, float py1, float px2, float py2)
px1
- x-coordinate of first point on segment.py1
- y-coordinate of first point on segment.px2
- x-coordinate of second point on segment.py2
- y-coordinate of second point on segment.Method Detail |
public int compare(Segment otherSegment)
otherSegment
- Segement which which to compare.
public int compare(float px, float py)
px
- x-coordinate of point to compare.py
- y-coordinate of point to compare.
public float calcDistance(float px, float py)
px
- x coordinate of point to consider.py
- y coordinate of point to consider.
public boolean intersectsEndpoint()
public float getPx1()
public float getPy1()
public float getPx2()
public float getPy2()
public boolean isUndefined()
public double getA()
public double getB()
public double getC()
public float getIntersectionX()
public float getIntersectionY()
public float getLength()
public String toString()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |