|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object ProGAL.geom3d.LineSegment
public class LineSegment
A line segment spanned by two points, a and b.
Constructor Summary | |
---|---|
LineSegment(Point a,
Point b)
Constructs a segment between points a and b. |
|
LineSegment(Point a,
Vector v)
Constructs a segment from a to a+v. |
Method Summary | |
---|---|
LineSegment |
clone()
Returns a deep clone of this line segment. |
boolean |
equals(LineSegment ls)
Returns true iff this line-segment and ls are the same. |
boolean |
equals(java.lang.Object o)
Returns true iff the argument is a line-segment and equals this. |
Point |
getA()
Get the first point spanning the segment. |
Vector |
getAToB()
Get the direction of the segment. |
Point |
getB()
Get the second point spanning the segment. |
Point |
getCenter()
Returns the mid-point of this line-segment. |
Point |
getClosestPoint(Point q)
Get the point on the segment closest to a given point q. |
int |
getDimension()
Return the 'dimension' of this object. |
double |
getDistance(Point q)
Gets the distance from q to the nearest point on this segment. |
double |
getLength()
Get the length of the segment. |
double |
getLengthSquared()
Get the squared length of the segment. |
Point |
getMidPoint()
Gets the midpoint of the segment. |
Point |
getPoint(int i)
TODO: Comment and test |
double |
getSquaredDistance(Point q)
Gets the squared distance from q to the nearest point on this segment. |
void |
setA(Point a)
Change the first point spanning the segment. |
void |
setB(Point b)
Change the second point spanning the segment. |
void |
toConsole()
Writes this segment to System.out . |
void |
toConsole(int dec)
Writes this segment to System.out with dec decimals precision. |
void |
toScene(J3DScene scene,
double r,
java.awt.Color clr)
|
java.lang.String |
toString()
Returns a string representation of this segments. |
java.lang.String |
toString(int dec)
Returns a string representation of this segments with dec decimals precision. |
Methods inherited from class java.lang.Object |
---|
getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public LineSegment(Point a, Point b)
public LineSegment(Point a, Vector v)
Method Detail |
---|
public Point getA()
public Point getB()
public void setA(Point a)
public void setB(Point b)
public Vector getAToB()
public double getLength()
public double getLengthSquared()
public Point getClosestPoint(Point q)
public double getSquaredDistance(Point q)
public double getDistance(Point q)
public Point getMidPoint()
public Point getCenter()
getCenter
in interface Shape
public Point getPoint(int i)
getPoint
in interface Simplex
public int getDimension()
getDimension
in interface Simplex
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public boolean equals(LineSegment ls)
public LineSegment clone()
clone
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object
public java.lang.String toString(int dec)
dec
decimals precision.
public void toConsole()
System.out
.
public void toConsole(int dec)
System.out
with dec
decimals precision.
public void toScene(J3DScene scene, double r, java.awt.Color clr)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |