com.partnersoft.v3x.graphics
Class IntegerLine

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

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

A int-precision line class.

See Also:
Serialized Form

Field Summary
 int x1
           
 int x2
           
 int y1
           
 int y2
           
 
Constructor Summary
IntegerLine()
           
IntegerLine(int x1, int y1, int x2, int y2)
           
 
Method Summary
 boolean clipToRectangle(IntegerRectangle rectangle)
          Clip this line to rectangle.
 boolean equals(IntegerLine nother)
           
 boolean equals(java.lang.Object nother)
           
 float getLength()
           
 float getSlope()
           
 int getX1()
           
 int getX2()
           
 int getY1()
           
 int getY2()
           
 boolean isDegenerate()
           
 boolean isHorizontal()
           
 boolean isVertical()
           
 void setToMatch(IntegerLine nother)
           
 void setX1(int newX)
           
 void setX2(int newX)
           
 void setY1(int newY)
           
 void setY2(int newY)
           
 int solveForX(int y)
          Finds the x for the given y.
 int solveForY(int 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 int x1

y1

public int y1

x2

public int x2

y2

public int y2
Constructor Detail

IntegerLine

public IntegerLine()

IntegerLine

public IntegerLine(int x1,
                   int y1,
                   int x2,
                   int y2)
Method Detail

getX1

public int getX1()

setX1

public void setX1(int newX)

getY1

public int getY1()

setY1

public void setY1(int newY)

getX2

public int getX2()

setX2

public void setX2(int newX)

getY2

public int getY2()

setY2

public void setY2(int newY)

setToMatch

public void setToMatch(IntegerLine 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 float getSlope()

getLength

public float getLength()

equals

public boolean equals(IntegerLine nother)

equals

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

solveForX

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


solveForY

public int solveForY(int 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(IntegerRectangle 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.