public final class RectBounds extends BaseBounds
BaseBounds.BoundsType| Modifier and Type | Field and Description |
|---|---|
private float |
maxX |
private float |
maxY |
private float |
minX |
private float |
minY |
| Constructor and Description |
|---|
RectBounds()
Create an axis aligned bounding rectangle object, with an empty bounds
where maxX < minX and maxY < minY.
|
RectBounds(float minX,
float minY,
float maxX,
float maxY)
Creates a RectBounds based on the minX, minY, maxX, and maxY values specified.
|
RectBounds(Rectangle other)
Creates a RectBounds object as a copy of the specified RECTANGLE.
|
RectBounds(RectBounds other)
Creates a RectBounds object as a copy of the specified RectBounds object.
|
| Modifier and Type | Method and Description |
|---|---|
void |
add(float x,
float y) |
void |
add(float x,
float y,
float z) |
void |
add(Point2D p) |
boolean |
contains(float x,
float y) |
boolean |
contains(Point2D p) |
boolean |
contains(RectBounds other)
Determines whether the given
other RectBounds is completely
contained within this RectBounds. |
BaseBounds |
copy()
Duplicates this instance.
|
BaseBounds |
deriveWithNewBounds(BaseBounds other) |
BaseBounds |
deriveWithNewBounds(float minX,
float minY,
float minZ,
float maxX,
float maxY,
float maxZ) |
BaseBounds |
deriveWithNewBounds(Rectangle other) |
BaseBounds |
deriveWithNewBoundsAndSort(float minX,
float minY,
float minZ,
float maxX,
float maxY,
float maxZ) |
BaseBounds |
deriveWithPadding(float h,
float v,
float d) |
BaseBounds |
deriveWithUnion(BaseBounds other) |
boolean |
disjoint(float x,
float y,
float width,
float height) |
boolean |
disjoint(RectBounds other) |
boolean |
equals(java.lang.Object obj) |
RectBounds |
flattenInto(RectBounds bounds)
Sets the given RectBounds (or creates a new instance of bounds is null) to
have the minX, minY, maxX, and maxY of this BoxBounds, dropping the Z values.
|
BaseBounds.BoundsType |
getBoundsType() |
float |
getDepth()
Convenience function for getting the depth of this RectBounds
The dimension along the Z-Axis, since this is a 2D bounds the return
value is always 0.0f.
|
float |
getHeight()
Convenience function for getting the height of this RectBounds
The dimension along the Y-Axis.
|
Vec2f |
getMax(Vec2f max) |
Vec3f |
getMax(Vec3f max) |
float |
getMaxX() |
float |
getMaxY() |
float |
getMaxZ() |
Vec2f |
getMin(Vec2f min) |
Vec3f |
getMin(Vec3f min) |
float |
getMinX() |
float |
getMinY() |
float |
getMinZ() |
float |
getWidth()
Convenience function for getting the width of this RectBounds.
|
void |
grow(float h,
float v) |
int |
hashCode() |
boolean |
intersects(BaseBounds other) |
boolean |
intersects(float x,
float y,
float width,
float height) |
void |
intersectWith(BaseBounds other) |
void |
intersectWith(float minX,
float minY,
float maxX,
float maxY) |
void |
intersectWith(float minX,
float minY,
float minZ,
float maxX,
float maxY,
float maxZ) |
void |
intersectWith(Rectangle other) |
boolean |
is2D()
Return true if this bounds is of a 2D BoundsType, else false.
|
boolean |
isEmpty() |
RectBounds |
makeEmpty() |
void |
roundOut()
Adjusts the edges of this RectBounds "outward" toward integral boundaries,
such that the rounded bounding box will always full enclose the original
bounding box.
|
void |
setBounds(float minX,
float minY,
float maxX,
float maxY)
Set the bounds to the given values.
|
void |
setBounds(RectBounds other)
Set the bounds to match that of the RectBounds object specified.
|
void |
setBoundsAndSort(float minX,
float minY,
float maxX,
float maxY)
Sets the bounds based on the given coords, and also ensures that after
having done so that this RectBounds instance is normalized.
|
void |
setBoundsAndSort(float minX,
float minY,
float minZ,
float maxX,
float maxY,
float maxZ) |
void |
setBoundsAndSort(Point2D p1,
Point2D p2)
Sets the bounds based on the given points, and also ensures that
after having done so that this bounds instance is sorted (x1<=x2 and y1<=y2).
|
void |
setMaxX(float maxX) |
void |
setMaxY(float maxY) |
void |
setMinX(float minX) |
void |
setMinY(float minY) |
protected void |
sortMinMax() |
java.lang.String |
toString() |
void |
translate(float x,
float y,
float z) |
void |
unionWith(float minX,
float minY,
float maxX,
float maxY) |
void |
unionWith(RectBounds other) |
getInstance, getInstanceprivate float minX
private float maxX
private float minY
private float maxY
public RectBounds()
public RectBounds(float minX,
float minY,
float maxX,
float maxY)
public RectBounds(RectBounds other)
public RectBounds(Rectangle other)
public BaseBounds copy()
BaseBoundscopy in class BaseBoundspublic BaseBounds.BoundsType getBoundsType()
getBoundsType in class BaseBoundspublic boolean is2D()
BaseBoundsis2D in class BaseBoundspublic float getWidth()
getWidth in class BaseBoundspublic float getHeight()
getHeight in class BaseBoundspublic float getDepth()
getDepth in class BaseBoundspublic float getMinX()
getMinX in class BaseBoundspublic void setMinX(float minX)
public float getMinY()
getMinY in class BaseBoundspublic void setMinY(float minY)
public float getMinZ()
getMinZ in class BaseBoundspublic float getMaxX()
getMaxX in class BaseBoundspublic void setMaxX(float maxX)
public float getMaxY()
getMaxY in class BaseBoundspublic void setMaxY(float maxY)
public float getMaxZ()
getMaxZ in class BaseBoundspublic Vec2f getMin(Vec2f min)
getMin in class BaseBoundspublic Vec2f getMax(Vec2f max)
getMax in class BaseBoundspublic Vec3f getMin(Vec3f min)
getMin in class BaseBoundspublic Vec3f getMax(Vec3f max)
getMax in class BaseBoundspublic BaseBounds deriveWithUnion(BaseBounds other)
deriveWithUnion in class BaseBoundspublic BaseBounds deriveWithNewBounds(Rectangle other)
deriveWithNewBounds in class BaseBoundspublic BaseBounds deriveWithNewBounds(BaseBounds other)
deriveWithNewBounds in class BaseBoundspublic BaseBounds deriveWithNewBounds(float minX, float minY, float minZ, float maxX, float maxY, float maxZ)
deriveWithNewBounds in class BaseBoundspublic BaseBounds deriveWithNewBoundsAndSort(float minX, float minY, float minZ, float maxX, float maxY, float maxZ)
deriveWithNewBoundsAndSort in class BaseBoundspublic final void setBounds(RectBounds other)
public final void setBounds(float minX,
float minY,
float maxX,
float maxY)
public void setBoundsAndSort(float minX,
float minY,
float maxX,
float maxY)
public void setBoundsAndSort(float minX,
float minY,
float minZ,
float maxX,
float maxY,
float maxZ)
setBoundsAndSort in class BaseBoundspublic void setBoundsAndSort(Point2D p1, Point2D p2)
BaseBoundssetBoundsAndSort in class BaseBoundspublic RectBounds flattenInto(RectBounds bounds)
BaseBoundsflattenInto in class BaseBoundsbounds - The bounds to fill with values, or null. If null, a new RectBounds
is returned. If not null, the given bounds will be populated and
then returnedpublic void unionWith(RectBounds other)
public void unionWith(float minX,
float minY,
float maxX,
float maxY)
public void add(float x,
float y,
float z)
add in class BaseBoundspublic void add(float x,
float y)
public void add(Point2D p)
add in class BaseBoundspublic void intersectWith(BaseBounds other)
intersectWith in class BaseBoundspublic void intersectWith(Rectangle other)
intersectWith in class BaseBoundspublic void intersectWith(float minX,
float minY,
float maxX,
float maxY)
public void intersectWith(float minX,
float minY,
float minZ,
float maxX,
float maxY,
float maxZ)
intersectWith in class BaseBoundspublic boolean contains(Point2D p)
contains in class BaseBoundspublic boolean contains(float x,
float y)
contains in class BaseBoundspublic boolean contains(RectBounds other)
other RectBounds is completely
contained within this RectBounds. Equivalent RectBounds will return true.other - The other rect bounds to check against.public boolean intersects(float x,
float y,
float width,
float height)
intersects in class BaseBoundspublic boolean intersects(BaseBounds other)
public boolean disjoint(float x,
float y,
float width,
float height)
disjoint in class BaseBoundspublic boolean disjoint(RectBounds other)
public boolean isEmpty()
isEmpty in class BaseBoundspublic void roundOut()
roundOut in class BaseBoundspublic void grow(float h,
float v)
public BaseBounds deriveWithPadding(float h, float v, float d)
deriveWithPadding in class BaseBoundspublic RectBounds makeEmpty()
makeEmpty in class BaseBoundsprotected void sortMinMax()
sortMinMax in class BaseBoundspublic void translate(float x,
float y,
float z)
translate in class BaseBoundspublic boolean equals(java.lang.Object obj)
equals in class java.lang.Objectpublic int hashCode()
hashCode in class java.lang.Objectpublic java.lang.String toString()
toString in class java.lang.Object