jdsl.geomobj.ref
Class RatRectangle2D

java.lang.Object
  |
  +--jdsl.geomobj.ref.AbstractGeomObject2D
        |
        +--jdsl.geomobj.ref.RatRectangle2D
All Implemented Interfaces:
ClosedCurve2D, Curve2D, GeomObject, GeomObject2D, Rectangle2D

public class RatRectangle2D
extends AbstractGeomObject2D
implements Rectangle2D

A two-dimensional rectangle constructed using two integer or rational points.

Version:
$Id: RatRectangle2D.java,v 1.5 2001/05/16 13:44:57 lv Exp $
Author:
Luca Vismara (lv)

Inner classes inherited from class jdsl.geomobj.api.GeomObject2D
GeomObject2D.NoneGeomObject2D
 
Field Summary
protected  RatPoint2D bottomLeft_
           
protected  RatPoint2D bottomRight_
           
protected  RatPoint2D topLeft_
           
protected  RatPoint2D topRight_
           
 
Fields inherited from class jdsl.geomobj.ref.AbstractGeomObject2D
gt, jn
 
Fields inherited from interface jdsl.geomobj.api.GeomObject2D
NONE
 
Constructor Summary
RatRectangle2D(Point2D p1, Point2D p2)
           
 
Method Summary
 int arithmeticType()
          The arithmetic type of a geometric object is encoded as an integer number.
 Point2D bottomLeftPoint()
           
 Point2D bottomRightPoint()
           
 boolean equals(java.lang.Object obj)
           
 Point2D[] points()
           
 Point2D topLeftPoint()
           
 Point2D topRightPoint()
           
 java.lang.String 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.GeomObject
dim
 

Field Detail

topLeft_

protected RatPoint2D topLeft_

topRight_

protected RatPoint2D topRight_

bottomLeft_

protected RatPoint2D bottomLeft_

bottomRight_

protected RatPoint2D bottomRight_
Constructor Detail

RatRectangle2D

public RatRectangle2D(Point2D p1,
                      Point2D p2)
               throws InvalidPointException
Parameters:
p1 - a corner of the rectangle; must be an integer or rational point
p2 - the corner of the rectangle diagonally opposite to p1; must be an integer or rational point
Throws:
InvalidPointException - if p1 and p2 are not integer or rational points, or if p1 and p2 are not diagonally opposite
Method Detail

equals

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

toString

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

arithmeticType

public int arithmeticType()
Description copied from interface: GeomObject
The arithmetic type of a geometric object is encoded as an integer number. Current legal values are: 0 = an integer geometric object 1 = a rational geometric object
Specified by:
arithmeticType in interface GeomObject
Following copied from interface: jdsl.geomobj.api.GeomObject
Returns:
the arithmetic type of this

points

public Point2D[] points()
Specified by:
points in interface ClosedCurve2D
Following copied from interface: jdsl.geomobj.api.ClosedCurve2D
Returns:
an array of points defining this; the points are in clockwise order

topLeftPoint

public Point2D topLeftPoint()
Specified by:
topLeftPoint in interface Rectangle2D
Following copied from interface: jdsl.geomobj.api.Rectangle2D
Returns:
the top-left point of this

topRightPoint

public Point2D topRightPoint()
Specified by:
topRightPoint in interface Rectangle2D
Following copied from interface: jdsl.geomobj.api.Rectangle2D
Returns:
the top-right point of this

bottomLeftPoint

public Point2D bottomLeftPoint()
Specified by:
bottomLeftPoint in interface Rectangle2D
Following copied from interface: jdsl.geomobj.api.Rectangle2D
Returns:
the bottom-left point of this

bottomRightPoint

public Point2D bottomRightPoint()
Specified by:
bottomRightPoint in interface Rectangle2D
Following copied from interface: jdsl.geomobj.api.Rectangle2D
Returns:
the bottom-right point of this