drasys.or.geom.rect2
Class Range

java.lang.Object
  |
  +--drasys.or.geom.rect2.Rect2
        |
        +--drasys.or.geom.rect2.Range

public class Range
extends Rect2
implements RangeI, java.io.Serializable

An implementation of a range in the 2D rectangular coordinate system. This range implementation is a scaler object and not a container, it maintains private copies of the boundary points.

See Also:
Serialized Form

Constructor Summary
Range(double x1, double y1, double x2, double y2)
           
Range(PointI point1, PointI point2)
           
Range(RangeI range)
           
 
Method Summary
 PointI bound(PointI point)
          Returns the argument 'point' if it is included in the range.
 PointI boundPoint(PointI point)
          Returns the argument 'point' if it is included in the range.
 PointI centroid()
           
 double distanceProxyTo(PointI point)
          Returns the distance proxy from the range boundary to a point.
 double distanceTo(PointI point)
          Returns the distance from the range boundary to a point.
 boolean equals(java.lang.Object o)
           
 RangeI getExpandedRange(PointI point)
          Returns a range that includes both this range and the argument.
 PointI getMax()
          Returns the maximum boundary point.
 PointI getMin()
          Returns the minimum boundary point.
 int hashCode()
           
 boolean includes(PointI point)
          Returns true if the point is inside the range or on the boundary.
 PointI lowerLeft()
          Returns the lower left boundary corner point: (minX,minY).
 PointI lowerRight()
          Returns the lower right boundary corner point: (minX,maxY).
 PointI max()
          Returns the max boundary corner point.
 double maxX()
           
 double maxY()
           
 PointI min()
          Returns the min boundary corner point.
 double minX()
           
 double minY()
           
 PointI nearestPointTo(PointI point)
          Returns the point on the boundary that is the least distance to 'point'.
 RangeI range()
           
 java.lang.String toString()
           
 PointI upperLeft()
          Returns the upper left boundary corner point: (minX,maxY).
 PointI upperRight()
          Returns the upper right boundary corner point: (maxX,maxY).
 
Methods inherited from class drasys.or.geom.rect2.Rect2
coordinateSystem, getCentroid, getDistanceProxyTo, getDistanceTo, getNearestPointTo, getRange
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Range

public Range(double x1,
             double y1,
             double x2,
             double y2)

Range

public Range(PointI point1,
             PointI point2)

Range

public Range(RangeI range)
Method Detail

range

public RangeI range()

centroid

public PointI centroid()

min

public PointI min()
Returns the min boundary corner point.
Specified by:
min in interface RangeI

max

public PointI max()
Returns the max boundary corner point.
Specified by:
max in interface RangeI

lowerLeft

public PointI lowerLeft()
Returns the lower left boundary corner point: (minX,minY).
Specified by:
lowerLeft in interface RangeI

upperRight

public PointI upperRight()
Returns the upper right boundary corner point: (maxX,maxY).
Specified by:
upperRight in interface RangeI

upperLeft

public PointI upperLeft()
Returns the upper left boundary corner point: (minX,maxY).
Specified by:
upperLeft in interface RangeI

lowerRight

public PointI lowerRight()
Returns the lower right boundary corner point: (minX,maxY).
Specified by:
lowerRight in interface RangeI

minX

public double minX()
Specified by:
minX in interface RangeI

minY

public double minY()
Specified by:
minY in interface RangeI

maxX

public double maxX()
Specified by:
maxX in interface RangeI

maxY

public double maxY()
Specified by:
maxY in interface RangeI

boundPoint

public PointI boundPoint(PointI point)
Returns the argument 'point' if it is included in the range. Otherwise; returns the point on the boundary that is closest to 'point'.

getMin

public PointI getMin()
Description copied from interface: RangeI
Returns the minimum boundary point.

getMax

public PointI getMax()
Description copied from interface: RangeI
Returns the maximum boundary point.

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

equals

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

toString

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

bound

public PointI bound(PointI point)
Returns the argument 'point' if it is included in the range. Otherwise; returns the point on the boundary that is closest to 'point'.
Specified by:
bound in interface RangeI

nearestPointTo

public PointI nearestPointTo(PointI point)
Returns the point on the boundary that is the least distance to 'point'.

distanceTo

public double distanceTo(PointI point)
Returns the distance from the range boundary to a point.

distanceProxyTo

public double distanceProxyTo(PointI point)
Returns the distance proxy from the range boundary to a point.

includes

public boolean includes(PointI point)
Returns true if the point is inside the range or on the boundary.
Throws:
GeomError - if the point is not in the same coordinate system.

getExpandedRange

public RangeI getExpandedRange(PointI point)
Returns a range that includes both this range and the argument. If this range already includes the argument, then 'this' is returned.


Copyright(C)1997-2000 by DRA Systems all rights reserved. OpsResearch.com