|
MATES 3.0-rc2 | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectorg.mates.util.Bounds
org.mates.util.BoundingBox
Class for defining the bounds on a rectangle in 2D Euclidean space.
Position| Constructor Summary | |
BoundingBox(double width,
double height)
Creates a new BoundingBox with a lower-left corner at the origin (0, 0) and an upper-right corner at ( width,
height). |
|
BoundingBox(Position2D lowerLeft,
Position2D upperRight)
Creates a new BoundingBox by defining its lower-left corner and its upper-right corner. |
|
| Method Summary | |
Position |
closestValidPosition(Position position)
Returns the closest Position2D to position
that is within these bounds. |
boolean |
contains(Position position)
Returns true if the region defined by the bounds
contains position. |
double |
getHeight()
Returns the height of this bounding box. |
Position2D |
getLowerLeft()
Returns the lower-left corner of the bounding box; |
Position2D |
getUpperRight()
Returns the upper-right corner of the bounding box. |
double |
getWidth()
Returns the width of this bounding box. |
void |
setLowerLeft(Position2D lowerLeft)
Sets the lower-left corner of the bounding box. |
void |
setUpperRight(Position2D upperRight)
Sets the upper-right corner of the bounding box. |
java.lang.String |
toString()
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
public BoundingBox(Position2D lowerLeft,
Position2D upperRight)
java.lang.IllegalArgumentException - if lowerLeft is
either further to the right than or higher than
upperRight.
public BoundingBox(double width,
double height)
width,
height).
java.lang.IllegalArgumentException - if either width
or height is non-positive.| Method Detail |
public Position2D getUpperRight()
public Position2D getLowerLeft()
public void setUpperRight(Position2D upperRight)
public void setLowerLeft(Position2D lowerLeft)
public double getWidth()
public double getHeight()
public boolean contains(Position position)
Boundstrue if the region defined by the bounds
contains position. The default implementation of
this function always returns true.
contains in class Boundspublic java.lang.String toString()
public Position closestValidPosition(Position position)
Position2D to position
that is within these bounds. If position is
within the bounds, itself will be returned (un-cloned). If
position is not instanceof Position2D, null is returned.
closestValidPosition in class Bounds
|
MATES 3.0-rc2 | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||