com.partnersoft.v3x.graphics
Class DoubleLine

java.lang.Object
  extended by com.partnersoft.v3x.graphics.DoubleLine
All Implemented Interfaces:
java.io.Serializable

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

A double-precision line class.

See Also:
Serialized Form

Field Summary
 double x1
           
 double x2
           
 double y1
           
 double y2
           
 
Constructor Summary
DoubleLine()
           
DoubleLine(double x1, double y1, double x2, double y2)
           
 
Method Summary
 boolean clipToRectangle(DoubleRectangle rectangle)
          Clip this line to rectangle.
 boolean equals(DoubleLine nother)
           
 boolean equals(java.lang.Object nother)
           
 double getLength()
           
 double getSlope()
           
 double getX1()
           
 double getX2()
           
 double getY1()
           
 double getY2()
           
 boolean isDegenerate()
           
 boolean isHorizontal()
           
 boolean isVertical()
           
 void setToMatch(DoubleLine nother)
           
 void setX1(double newX)
           
 void setX2(double newX)
           
 void setY1(double newY)
           
 void setY2(double newY)
           
 double solveForX(double y)
          Finds the x for the given y.
 double solveForY(double x)
          Finds the y for the given x.
 void sortBottomToTop()
          Makes it run from bottom to top (so y1 <= y2)
 void sortLeftToRight()
          Makes it run from left to right (so x1 <= x2)
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

x1

public double x1

y1

public double y1

x2

public double x2

y2

public double y2
Constructor Detail

DoubleLine

public DoubleLine()

DoubleLine

public DoubleLine(double x1,
                  double y1,
                  double x2,
                  double y2)
Method Detail

getX1

public double getX1()

setX1

public void setX1(double newX)

getY1

public double getY1()

setY1

public void setY1(double newY)

getX2

public double getX2()

setX2

public void setX2(double newX)

getY2

public double getY2()

setY2

public void setY2(double newY)

setToMatch

public void setToMatch(DoubleLine nother)

toString

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

isDegenerate

public boolean isDegenerate()

isVertical

public boolean isVertical()

isHorizontal

public boolean isHorizontal()

getSlope

public double getSlope()

getLength

public double getLength()

equals

public boolean equals(DoubleLine nother)

equals

public boolean equals(java.lang.Object nother)
Overrides:
equals in class java.lang.Object

solveForX

public double solveForX(double y)
Finds the x for the given y.


solveForY

public double solveForY(double x)
Finds the y for the given x.


sortLeftToRight

public void sortLeftToRight()
Makes it run from left to right (so x1 <= x2)


sortBottomToTop

public void sortBottomToTop()
Makes it run from bottom to top (so y1 <= y2)


clipToRectangle

public boolean clipToRectangle(DoubleRectangle rectangle)
Clip this line to rectangle. Returns false if the line does not intersect the rectangle, and leaves x and y in an indeterminate state.