com.imagero.geom
Class LineSegment

java.lang.Object
  extended bycom.imagero.geom.Line
      extended bycom.imagero.geom.LineSegment

public class LineSegment
extends Line

LineSegment is like a Line, but bounded through 2 Points


Constructor Summary
LineSegment(LineSegment ls)
           
LineSegment(java.awt.geom.Point2D p1, java.awt.geom.Point2D p2)
           
LineSegment(java.awt.Point p1, java.awt.Point p2)
           
 
Method Summary
 boolean contains(java.awt.Point p)
          determine if given point lies on this line
 boolean contains(java.awt.Point p, double round)
           
 java.awt.Point getP1()
           
 java.awt.Point getP2()
           
 boolean intersects(LineSegment ls)
           
 java.awt.Point nearestPoint(java.awt.Point p)
          find nearest point on this Line to supplied Point
 void set(java.awt.Point p1, java.awt.Point p2)
           
 void setP1(java.awt.Point p)
           
 void setP2(java.awt.Point p)
           
 java.lang.String toString()
          Returns a string representation of the object.
 
Methods inherited from class com.imagero.geom.Line
getX, getY, intersection, isOver, isUnder
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

LineSegment

public LineSegment(LineSegment ls)

LineSegment

public LineSegment(java.awt.geom.Point2D p1,
                   java.awt.geom.Point2D p2)

LineSegment

public LineSegment(java.awt.Point p1,
                   java.awt.Point p2)
Method Detail

contains

public boolean contains(java.awt.Point p)
Description copied from class: Line
determine if given point lies on this line

Overrides:
contains in class Line
Parameters:
p - Point
Returns:
true if Point p is on this line

contains

public boolean contains(java.awt.Point p,
                        double round)
Overrides:
contains in class Line

getP1

public java.awt.Point getP1()

getP2

public java.awt.Point getP2()

intersects

public boolean intersects(LineSegment ls)
Overrides:
intersects in class Line

nearestPoint

public java.awt.Point nearestPoint(java.awt.Point p)
Description copied from class: Line
find nearest point on this Line to supplied Point

Overrides:
nearestPoint in class Line
Parameters:
p - Point
Returns:
nearest Point

set

public void set(java.awt.Point p1,
                java.awt.Point p2)
Overrides:
set in class Line

setP1

public void setP1(java.awt.Point p)

setP2

public void setP2(java.awt.Point p)

toString

public java.lang.String toString()
Description copied from class: java.lang.Object
Returns a string representation of the object. In general, the toString method returns a string that "textually represents" this object. The result should be a concise but informative representation that is easy for a person to read. It is recommended that all subclasses override this method.

The toString method for class Object returns a string consisting of the name of the class of which the object is an instance, the at-sign character `@', and the unsigned hexadecimal representation of the hash code of the object. In other words, this method returns a string equal to the value of:

 getClass().getName() + '@' + Integer.toHexString(hashCode())
 

Returns:
a string representation of the object.