jdsl.geomobj.ref
Class IntSegment2D

java.lang.Object
  |
  +--jdsl.geomobj.ref.AbstractGeomObject2D
        |
        +--jdsl.geomobj.ref.AbstractLinearCurve2D
              |
              +--jdsl.geomobj.ref.AbstractIntLinearCurve2D
                    |
                    +--jdsl.geomobj.ref.IntSegment2D
All Implemented Interfaces:
Curve2D, GeomObject, GeomObject2D, LinearCurve2D, OpenCurve2D, Segment2D

public class IntSegment2D
extends AbstractIntLinearCurve2D
implements Segment2D

IntSegment2D is a Segment2D constructed using two distinct integer points.

Version:
$Id: IntSegment2D.java,v 1.3 2000/03/23 14:14:32 lv Exp $
Author:
Masi Oka (mao), Luca Vismara (lv )

Inner classes inherited from class jdsl.geomobj.api.GeomObject2D
GeomObject2D.NoneGeomObject2D
 
Fields inherited from class jdsl.geomobj.ref.AbstractIntLinearCurve2D
dir_, p1_, p2_
 
Fields inherited from class jdsl.geomobj.ref.AbstractLinearCurve2D
bottom_, INFINITE, left_, NEGATIVE, POSITIVE, right_, slope_, top_, ZERO
 
Fields inherited from class jdsl.geomobj.ref.AbstractGeomObject2D
gt, jn
 
Fields inherited from interface jdsl.geomobj.api.GeomObject2D
NONE
 
Constructor Summary
IntSegment2D(Point2D p1, Point2D p2)
          Creates a segment passing with endpoints p1 and p2; the underlying direction is from p1 to p2.
 
Method Summary
 Point2D bottomPoint()
           
 boolean equals(java.lang.Object obj)
           
 Point2D leftPoint()
           
 Point2D rightPoint()
           
 Line2D supportingLine()
           
 Point2D topPoint()
           
 
Methods inherited from class jdsl.geomobj.ref.AbstractIntLinearCurve2D
arithmeticType, direction, points
 
Methods inherited from class jdsl.geomobj.ref.AbstractLinearCurve2D
isDecreasing, isHorizontal, isIncreasing, isVertical, toString
 
Methods inherited from class jdsl.geomobj.ref.AbstractGeomObject2D
dim
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface jdsl.geomobj.api.LinearCurve2D
direction, isDecreasing, isHorizontal, isIncreasing, isVertical
 
Methods inherited from interface jdsl.geomobj.api.OpenCurve2D
points
 
Methods inherited from interface jdsl.geomobj.api.GeomObject
arithmeticType, dim
 

Constructor Detail

IntSegment2D

public IntSegment2D(Point2D p1,
                    Point2D p2)
             throws InvalidPointException
Creates a segment passing with endpoints p1 and p2; the underlying direction is from p1 to p2.
Parameters:
p1 - one endpoint of the segment; must be an integer point
p2 - the other endpoint of the segment; must be an integer point distinct from p1
Throws:
InvalidPointException - if p1 and p2 are not integer points, or if p1 and p2 are coincident
Method Detail

equals

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

bottomPoint

public Point2D bottomPoint()
Specified by:
bottomPoint in interface Segment2D
Following copied from interface: jdsl.geomobj.api.Segment2D
Returns:
the bottom endpoint of this; any endpoint if this is horizontal

topPoint

public Point2D topPoint()
Specified by:
topPoint in interface Segment2D
Following copied from interface: jdsl.geomobj.api.Segment2D
Returns:
the top endpoint of this; any endpoint if this is horizontal

leftPoint

public Point2D leftPoint()
Specified by:
leftPoint in interface Segment2D
Following copied from interface: jdsl.geomobj.api.Segment2D
Returns:
the leftmost endpoint of this; any endpoint if this is vertical

rightPoint

public Point2D rightPoint()
Specified by:
rightPoint in interface Segment2D
Following copied from interface: jdsl.geomobj.api.Segment2D
Returns:
the rightmost endpoint of this; any endpoint if this is vertical

supportingLine

public Line2D supportingLine()
Specified by:
supportingLine in interface Segment2D
Following copied from interface: jdsl.geomobj.api.Segment2D
Returns:
the line passing through the endpoints and with the same direction of this