Constructor and Description |
---|
LineSegment(Point a,
Point b) |
Modifier and Type | Method and Description |
---|---|
LineSegment |
clone() |
boolean |
contains(Point p) |
double |
distance(Point p) |
Point |
getA() |
Point |
getB() |
Point |
getCenter()
Get the geometric center of the shape.
|
double |
getLength()
returns the length of the line segment
|
double |
getSquaredLength()
returns the squared length of the segment
|
boolean |
intersects(LineSegment s)
returns TRUE if this line segment properly intersects line segment s.
|
LineSegment |
reverse()
swaps the end-points of this segment
|
void |
setA(Point p) |
void |
setB(Point p) |
void |
toConsole() |
void |
toScene(J2DScene scene) |
void |
toScene(J2DScene scene,
java.awt.Color clr) |
void |
toScene(J2DScene scene,
java.awt.Color clr,
double width) |
java.lang.String |
toString() |
public Point getA()
public Point getB()
public void setA(Point p)
public void setB(Point p)
public double getLength()
public double getSquaredLength()
public LineSegment clone()
clone
in class java.lang.Object
public Point getCenter()
Shape
public LineSegment reverse()
public boolean intersects(LineSegment s)
public java.lang.String toString()
toString
in class java.lang.Object
public void toConsole()
public void toScene(J2DScene scene)
public void toScene(J2DScene scene, java.awt.Color clr)
public void toScene(J2DScene scene, java.awt.Color clr, double width)
public double distance(Point p)