subscript.geom
Class GLineSegment2D

java.lang.Object
  extended by subscript.geom.GLineSegment2D
All Implemented Interfaces:
java.io.Serializable

public class GLineSegment2D
extends java.lang.Object
implements java.io.Serializable

A 2D line with end points.

See Also:
Serialized Form

Field Summary
 GLine2D line
           
 GPoint2D p1
           
 GPoint2D p2
           
 int weight
           
 
Constructor Summary
GLineSegment2D(GPoint2D p1, GPoint2D p2)
           
 
Method Summary
 GPoint2D closestPoint(GPoint2D p)
           
 double distanceTo(GPoint2D p)
           
 GLine2D getLine()
           
 GPoint2D intersectionWith(GLine2D l)
          Returns the point where this segment intersects this line, or null if they do not intersect.
 GPoint2D intersectionWith(GLineSegment2D seg)
           
 double length()
           
 double lengthOfProjectionOnto(GLineSegment2D seg)
           
 double squaredDistanceTo(GPoint2D p)
           
 GLineSegment2D transform(Matrix P)
           
static java.util.ArrayList<GLineSegment2D> transformSegments(java.util.ArrayList<GLineSegment2D> segs, Matrix P)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

line

public transient GLine2D line

p1

public GPoint2D p1

p2

public GPoint2D p2

weight

public int weight
Constructor Detail

GLineSegment2D

public GLineSegment2D(GPoint2D p1,
                      GPoint2D p2)
Method Detail

getLine

public GLine2D getLine()

intersectionWith

public GPoint2D intersectionWith(GLine2D l)
Returns the point where this segment intersects this line, or null if they do not intersect.


intersectionWith

public GPoint2D intersectionWith(GLineSegment2D seg)

closestPoint

public GPoint2D closestPoint(GPoint2D p)

squaredDistanceTo

public double squaredDistanceTo(GPoint2D p)

length

public double length()

distanceTo

public double distanceTo(GPoint2D p)

transform

public GLineSegment2D transform(Matrix P)

transformSegments

public static java.util.ArrayList<GLineSegment2D> transformSegments(java.util.ArrayList<GLineSegment2D> segs,
                                                                    Matrix P)

lengthOfProjectionOnto

public double lengthOfProjectionOnto(GLineSegment2D seg)