uk.ac.leeds.ccg.andyt.vector.geometry
Class LineSegment2D

java.lang.Object
  extended by uk.ac.leeds.ccg.andyt.vector.geometry.AbstractGeometry2D
      extended by uk.ac.leeds.ccg.andyt.vector.geometry.LineSegment2D
All Implemented Interfaces:
java.lang.Comparable

public class LineSegment2D
extends AbstractGeometry2D
implements java.lang.Comparable

A stright line connecting two points. The line has a direction as given by the order of the points. Two such points are the same iff their start and end points are the same.


Field Summary
 Point2D _End_Point2D
           
 Point2D _Start_Point2D
           
 
Fields inherited from class uk.ac.leeds.ccg.andyt.vector.geometry.AbstractGeometry2D
_DecimalPlacePrecision, _RoundingMode
 
Constructor Summary
LineSegment2D()
           
LineSegment2D(LineSegment2D a_LineSegment2D)
           
LineSegment2D(Point2D _StartPoint, Point2D _EndPoint)
           
LineSegment2D(Point2D _StartPoint, Point2D _EndPoint, int _DecimalPlacePrecision, java.math.RoundingMode _RoundingMode)
           
 
Method Summary
 void applyDecimalPlacePrecision()
           
 int compareTo(java.lang.Object o)
          Default is 1.
 Envelope2D getEnvelope2D()
           
protected  java.math.BigDecimal getGradient()
           
 AbstractGeometry2D getIntersection(LineSegment2D a_LineSegment2D)
           
 boolean getIntersects(LineSegment2D a_LineSegment2D)
          Intersection done by first seeing if Envelope intersection....
 boolean getIntersects(Point2D a_Point2D)
          Intersection done by calculating angle or gradient of the line and comparing this with that of a_Point.
 java.math.BigDecimal getLength(int numberOfDecimalPlaces)
           
 LineSegment2D getOrderedLineSegment2D()
           
protected  boolean isOnGradient(Point2D a_Point2D)
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

_Start_Point2D

public Point2D _Start_Point2D

_End_Point2D

public Point2D _End_Point2D
Constructor Detail

LineSegment2D

public LineSegment2D()

LineSegment2D

public LineSegment2D(Point2D _StartPoint,
                     Point2D _EndPoint)

LineSegment2D

public LineSegment2D(Point2D _StartPoint,
                     Point2D _EndPoint,
                     int _DecimalPlacePrecision,
                     java.math.RoundingMode _RoundingMode)

LineSegment2D

public LineSegment2D(LineSegment2D a_LineSegment2D)
Method Detail

toString

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

compareTo

public int compareTo(java.lang.Object o)
Default is 1. Calls compareTo on the _StartPoint.

Specified by:
compareTo in interface java.lang.Comparable

getLength

public java.math.BigDecimal getLength(int numberOfDecimalPlaces)

getEnvelope2D

public Envelope2D getEnvelope2D()
Specified by:
getEnvelope2D in class AbstractGeometry2D

getIntersects

public boolean getIntersects(LineSegment2D a_LineSegment2D)
Intersection done by first seeing if Envelope intersection....

Parameters:
aPoint -
Returns:
true iff a_LineSegment2D intersects this.

getIntersects

public boolean getIntersects(Point2D a_Point2D)
Intersection done by calculating angle or gradient of the line and comparing this with that of a_Point.

Parameters:
aPoint -
Returns:
true iff a_Point2D intersects this.

getGradient

protected java.math.BigDecimal getGradient()

isOnGradient

protected boolean isOnGradient(Point2D a_Point2D)

getOrderedLineSegment2D

public LineSegment2D getOrderedLineSegment2D()

getIntersection

public AbstractGeometry2D getIntersection(LineSegment2D a_LineSegment2D)
Returns:
null if this does not intersect a_LineSegment2D; a Point2D if this intersects a_LineSegment2D at a point; and, a LineSegment2D if this intersects a_LineSegment2D in a line.

applyDecimalPlacePrecision

public void applyDecimalPlacePrecision()
Specified by:
applyDecimalPlacePrecision in class AbstractGeometry2D