public class BoundingBox
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
Vector2D |
lower
The corner of the bounding box with the smaller x,y coordinates.
|
Vector2D |
upper
The corner of the bounding box with the larger x,y coordinates.
|
Constructor and Description |
---|
BoundingBox(BoundingBox b)
Constructor: an instance is a copy of bounding box b.
|
BoundingBox(Vector2D lower,
Vector2D upper)
Constructor: An instance with lower as smaller coordinates and
upper as larger coordinates.
|
Modifier and Type | Method and Description |
---|---|
boolean |
contains(Vector2D p)
Return true iff this bounding box contains p.
|
BoundingBox |
displaced(Vector2D d)
Return the result of displacing this bounding box by d.
|
static BoundingBox |
findBBox(java.util.Iterator<Block> iter)
Return the bounding box of blocks given by iter.
|
double |
getArea()
Return the area of this bounding box.
|
Vector2D |
getCenter()
Return the center of this bounding box.
|
double |
getHeight()
Return the height of this bounding box (along y-dimension).
|
double |
getLength()
Return the larger of the width and height of this bounding box.
|
double |
getWidth()
Return the width of this bounding box (along x-dimension).
|
boolean |
overlaps(BoundingBox box)
Return true iff this bounding box overlaps with box.
|
java.lang.String |
toString()
Return a representation of this bounding box.
|
public Vector2D lower
public Vector2D upper
public BoundingBox(BoundingBox b)
public double getWidth()
public double getHeight()
public double getLength()
public Vector2D getCenter()
public BoundingBox displaced(Vector2D d)
public boolean contains(Vector2D p)
public double getArea()
public boolean overlaps(BoundingBox box)
public static BoundingBox findBBox(java.util.Iterator<Block> iter)
public java.lang.String toString()
toString
in class java.lang.Object