|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.partnersoft.geometry.Line
public class Line
A double-precision line class.
| Field Summary | |
|---|---|
double |
x1
|
double |
x2
|
double |
y1
|
double |
y2
|
| Constructor Summary | |
|---|---|
Line()
|
|
Line(double x1,
double y1,
double x2,
double y2)
|
|
| Method Summary | |
|---|---|
boolean |
clipToRectangle(Rectangle rectangle)
Clip this line to rectangle. |
boolean |
equals(Line nother)
|
boolean |
equals(java.lang.Object nother)
|
Point |
getCenter()
|
double |
getLength()
|
double |
getSlope()
|
double |
getX1()
|
double |
getX2()
|
double |
getY1()
|
double |
getY2()
|
Point |
intersect(Line nother)
Finds the intersection point for the two lines. |
boolean |
isDegenerate()
|
boolean |
isHorizontal()
|
boolean |
isRightOf(double x,
double y)
Returns true if this line lies to the "right" of the given point, Imagine yourself walking from x1,y1 to x2, y2. |
boolean |
isVertical()
|
void |
setToMatch(Line nother)
|
void |
setX1(double newX)
|
void |
setX2(double newX)
|
void |
setY1(double newY)
|
void |
setY2(double newY)
|
double |
solveForX(double y)
Finds the x for the given y. |
double |
solveForY(double x)
Finds the y for the given x. |
void |
sortLeftToRight()
Makes it run from left to right (so x1 <= x2) |
void |
swapEnds()
Swaps ends (x1 and x2, y1 and y2) |
java.lang.String |
toString()
|
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public double x1
public double y1
public double x2
public double y2
| Constructor Detail |
|---|
public Line()
public Line(double x1,
double y1,
double x2,
double y2)
| Method Detail |
|---|
public double getX1()
public void setX1(double newX)
public double getY1()
public void setY1(double newY)
public double getX2()
public void setX2(double newX)
public double getY2()
public void setY2(double newY)
public void setToMatch(Line nother)
public java.lang.String toString()
toString in class java.lang.Objectpublic boolean isDegenerate()
public boolean isVertical()
public boolean isHorizontal()
public double getSlope()
public double getLength()
public boolean equals(Line nother)
public boolean equals(java.lang.Object nother)
equals in class java.lang.Objectpublic Point getCenter()
public double solveForX(double y)
public double solveForY(double x)
public void sortLeftToRight()
public Point intersect(Line nother)
public void swapEnds()
public boolean isRightOf(double x,
double y)
public boolean clipToRectangle(Rectangle rectangle)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||