public class BoundingBox2DFloat
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
private float |
maxX
The maximum X coordinate.
|
private float |
maxY
The maximum Y coordinate.
|
private float |
minX
The minimum X coordinate.
|
private float |
minY
The minimum Y coordinate.
|
Constructor and Description |
---|
BoundingBox2DFloat()
Public constructor to construct an empty bounding box.
|
BoundingBox2DFloat(BoundingBox2DFloat orig)
Copy constructor.
|
BoundingBox2DFloat(float x,
float y)
Construct a zero-sized BoundingBox around a single point.
|
BoundingBox2DFloat(float x1,
float y1,
float x2,
float y2)
Construct a BoundingBox with the specified coordinates.
|
BoundingBox2DFloat(Point2DFloat p)
Construct a zero-sized BoundingBox around a single point.
|
BoundingBox2DFloat(Point2DFloat p1,
Point2DFloat p2)
Construct a BoundingBox with the specified coordinates.
|
Modifier and Type | Method and Description |
---|---|
void |
addPoint(float x,
float y)
Add a point to a BoundingBox.
|
void |
addPoint(Point2DFloat p)
Add a point to a BoundingBox.
|
BoundingBox2DFloat |
expand(float expandBy)
Expands a BoundingBox2DFloat by the specified value on each side and
returns a new bounding box.
|
BoundingBox2DFloat |
expand(float expandX,
float expandY)
Expands a BoundingBox2DFloat by the specified value on each side and
returns a new bounding box.
|
BoundingBox2DFloat |
expand(float xmin,
float ymin,
float xmax,
float ymax)
Expands a BoundingBox2DFloat by the specified value on each side and
returns a new bounding box.
|
float |
getMaxX()
Returns the maximum value of x.
|
float |
getMaxY()
Returns the maximum value of y.
|
float |
getMinX()
Returns the minimum value of x.
|
float |
getMinY()
Returns the minimum value of y.
|
BoundingBox2DFloat |
intersection(BoundingBox2DFloat b1,
BoundingBox2DFloat b2)
Returns a new BoundingBox2DFloat which is the intersection of two
bounding boxes.
|
boolean |
isEmpty()
Returns true if this is empty.
|
boolean |
isInside(float x,
float y)
Returns true if the point is within the bounding box.
|
BoundingBox2DFloat |
scaleAround(float cx,
float cy,
float scale)
Scales a BoundingBox2DFloat around a point [cx, cy]
and returns a new bounding box that could contain its scaled area.
|
java.lang.String |
toString()
Returns the bounding box as a human-readable string.
|
static BoundingBox2DFloat |
union(BoundingBox2DFloat b1,
BoundingBox2DFloat b2)
Returns a new BoundingBox2DFloat which is the union of two bounding
boxes.
|
private float minX
private float maxX
private float minY
private float maxY
public BoundingBox2DFloat()
public BoundingBox2DFloat(float x, float y)
public BoundingBox2DFloat(BoundingBox2DFloat orig)
public BoundingBox2DFloat(Point2DFloat p)
public BoundingBox2DFloat(float x1, float y1, float x2, float y2)
public BoundingBox2DFloat(Point2DFloat p1, Point2DFloat p2)
public void addPoint(float x, float y)
public void addPoint(Point2DFloat p)
public float getMinX()
public float getMaxX()
public float getMinY()
public float getMaxY()
public boolean isEmpty()
public static BoundingBox2DFloat union(BoundingBox2DFloat b1, BoundingBox2DFloat b2)
public BoundingBox2DFloat intersection(BoundingBox2DFloat b1, BoundingBox2DFloat b2)
public boolean isInside(float x, float y)
public java.lang.String toString()
toString
in class java.lang.Object
public BoundingBox2DFloat scaleAround(float cx, float cy, float scale)
public BoundingBox2DFloat expand(float expandBy)
public BoundingBox2DFloat expand(float expandX, float expandY)
public BoundingBox2DFloat expand(float xmin, float ymin, float xmax, float ymax)