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, getInstance
private 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()
BaseBounds
copy
in class BaseBounds
public BaseBounds.BoundsType getBoundsType()
getBoundsType
in class BaseBounds
public boolean is2D()
BaseBounds
is2D
in class BaseBounds
public float getWidth()
getWidth
in class BaseBounds
public float getHeight()
getHeight
in class BaseBounds
public float getDepth()
getDepth
in class BaseBounds
public float getMinX()
getMinX
in class BaseBounds
public void setMinX(float minX)
public float getMinY()
getMinY
in class BaseBounds
public void setMinY(float minY)
public float getMinZ()
getMinZ
in class BaseBounds
public float getMaxX()
getMaxX
in class BaseBounds
public void setMaxX(float maxX)
public float getMaxY()
getMaxY
in class BaseBounds
public void setMaxY(float maxY)
public float getMaxZ()
getMaxZ
in class BaseBounds
public Vec2f getMin(Vec2f min)
getMin
in class BaseBounds
public Vec2f getMax(Vec2f max)
getMax
in class BaseBounds
public Vec3f getMin(Vec3f min)
getMin
in class BaseBounds
public Vec3f getMax(Vec3f max)
getMax
in class BaseBounds
public BaseBounds deriveWithUnion(BaseBounds other)
deriveWithUnion
in class BaseBounds
public BaseBounds deriveWithNewBounds(Rectangle other)
deriveWithNewBounds
in class BaseBounds
public BaseBounds deriveWithNewBounds(BaseBounds other)
deriveWithNewBounds
in class BaseBounds
public BaseBounds deriveWithNewBounds(float minX, float minY, float minZ, float maxX, float maxY, float maxZ)
deriveWithNewBounds
in class BaseBounds
public BaseBounds deriveWithNewBoundsAndSort(float minX, float minY, float minZ, float maxX, float maxY, float maxZ)
deriveWithNewBoundsAndSort
in class BaseBounds
public 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 BaseBounds
public void setBoundsAndSort(Point2D p1, Point2D p2)
BaseBounds
setBoundsAndSort
in class BaseBounds
public RectBounds flattenInto(RectBounds bounds)
BaseBounds
flattenInto
in class BaseBounds
bounds
- 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 BaseBounds
public void add(float x, float y)
public void add(Point2D p)
add
in class BaseBounds
public void intersectWith(BaseBounds other)
intersectWith
in class BaseBounds
public void intersectWith(Rectangle other)
intersectWith
in class BaseBounds
public 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 BaseBounds
public boolean contains(Point2D p)
contains
in class BaseBounds
public boolean contains(float x, float y)
contains
in class BaseBounds
public 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 BaseBounds
public boolean intersects(BaseBounds other)
public boolean disjoint(float x, float y, float width, float height)
disjoint
in class BaseBounds
public boolean disjoint(RectBounds other)
public boolean isEmpty()
isEmpty
in class BaseBounds
public void roundOut()
roundOut
in class BaseBounds
public void grow(float h, float v)
public BaseBounds deriveWithPadding(float h, float v, float d)
deriveWithPadding
in class BaseBounds
public RectBounds makeEmpty()
makeEmpty
in class BaseBounds
protected void sortMinMax()
sortMinMax
in class BaseBounds
public void translate(float x, float y, float z)
translate
in class BaseBounds
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object