jdsl.geomobj.ref
Class RatSegment2D

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

public class RatSegment2D
extends AbstractRatLinearCurve2D
implements Segment2D

A Segment2D constructed using two distinct integer or rational points.

Version:
$Id: RatSegment2D.java,v 1.4 2001/04/28 10:52:58 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.AbstractRatLinearCurve2D
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
RatSegment2D(Point2D p1, Point2D p2)
          Creates a segment 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.AbstractRatLinearCurve2D
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

RatSegment2D

public RatSegment2D(Point2D p1,
                    Point2D p2)
             throws InvalidPointException
Creates a segment with endpoints p1 and p2; the underlying direction is from p1 to p2.
Parameters:
p1 - one endpoint of the segment; must be an integer or a rational point
p2 - the other endpoint of the segment; must be an integer or rational point distinct from p1
Throws:
InvalidPointException - if p1 and p2 are not integer or rational points, or if they 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