|
Algorithm Development Kit 1.0 |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface ILineSegment
A Line Segment between two-dimensional points.
The common etiquette is that the start of a line segment has the higher y-value than the end of the line segment; note for horizontal line segments the start will be the one whose x-value is smaller (i.e., left-to-right).
Field Summary | |
---|---|
static int |
COINCIDENT
|
static int |
INTERSECTING
|
static int |
NON_INTERSECTING
|
static int |
PARALLEL
Types of intersecting line segments. |
Method Summary | |
---|---|
IPoint |
getEnd()
Return the coordinate value of the End of the line segment as a two-dimensional IPoint. |
IPoint |
getStart()
Return the coordinate value of the Start of the line segment as a two-dimensional IPoint. |
IPoint |
intersection(ILineSegment other)
Return the intersection point with the given Line Segment, or null if no such intersection. |
boolean |
intersection(IPoint p)
Determine if Line Segment intersects the given point. |
boolean |
isHorizontal()
Determine if horizontal line. |
boolean |
isPoint()
Determine if this line segment is simply a point (same start & end). |
boolean |
isVertical()
Determine if vertical line. |
boolean |
pointOnLeft(IPoint p)
Determine if the given point is to the left of the line segment, if we view the line segment from the lower (end) point to the upper (start) point. |
boolean |
pointOnRight(IPoint p)
Determine if the given point is to the right of the line segment, if we view the line segment from the lower (end) point to the upper (start) point. |
int |
sign()
Return the sign of the slope of the line segment. |
double |
slope()
Return the slope of the line segment. |
double |
yIntercept()
Return the y-intercept of the line segment if it were extended to be a full line. |
Field Detail |
---|
static final int PARALLEL
static final int COINCIDENT
static final int INTERSECTING
static final int NON_INTERSECTING
Method Detail |
---|
IPoint getStart()
IPoint getEnd()
boolean isPoint()
double slope()
int sign()
boolean isHorizontal()
boolean isVertical()
IPoint intersection(ILineSegment other)
boolean intersection(IPoint p)
boolean pointOnRight(IPoint p)
boolean pointOnLeft(IPoint p)
double yIntercept()
|
Algorithm Development Kit 1.0 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |