ProGAL.geom2d
Class LineSegment

java.lang.Object
  extended by ProGAL.geom2d.LineSegment
All Implemented Interfaces:
Shape

public class LineSegment
extends java.lang.Object
implements Shape


Constructor Summary
LineSegment(Point a, Point b)
           
 
Method Summary
 LineSegment clone()
           
 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)
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

LineSegment

public LineSegment(Point a,
                   Point b)
Method Detail

getA

public Point getA()

getB

public Point getB()

setA

public void setA(Point p)

setB

public void setB(Point p)

getLength

public double getLength()
returns the length of the line segment


getSquaredLength

public double getSquaredLength()
returns the squared length of the segment


clone

public LineSegment clone()
Overrides:
clone in class java.lang.Object

getCenter

public Point getCenter()
Description copied from interface: Shape
Get the geometric center of the shape. The center of a shape can be interpreted in many ways (center of mass, circumcenter, inscribed center etc.). No strict requirement is given here, but typically the circumcenter should be supplied. This method is most prominently used to find the average center-position of a collection of shapes such that scene-viewers can be centered on the scene.

Specified by:
getCenter in interface Shape

reverse

public LineSegment reverse()
swaps the end-points of this segment


intersects

public boolean intersects(LineSegment s)
returns TRUE if this line segment properly intersects line segment s.


toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

toConsole

public void toConsole()

toScene

public void toScene(J2DScene scene)

distance

public double distance(Point p)