Package com.badlogic.gdx.math.collision
Class OrientedBoundingBox
- java.lang.Object
-
- com.badlogic.gdx.math.collision.OrientedBoundingBox
-
- All Implemented Interfaces:
java.io.Serializable
public class OrientedBoundingBox extends java.lang.Object implements java.io.Serializable
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description OrientedBoundingBox()
Constructs a new oriented bounding box with the minimum and maximum vector set to zeros.OrientedBoundingBox(BoundingBox bounds)
Constructs a new oriented bounding box from the given bounding box.OrientedBoundingBox(BoundingBox bounds, Matrix4 transform)
Constructs a new oriented bounding box from the given bounding box and transform.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
contains(BoundingBox b)
Returns whether the given bounding box is contained in this oriented bounding box.boolean
contains(OrientedBoundingBox obb)
Returns whether the given oriented bounding box is contained in this oriented bounding box.boolean
contains(Vector3 v)
Returns whether the given vector is contained in this oriented bounding box.BoundingBox
getBounds()
Get the current bounds.Vector3
getCorner000(Vector3 out)
Vector3
getCorner001(Vector3 out)
Vector3
getCorner010(Vector3 out)
Vector3
getCorner011(Vector3 out)
Vector3
getCorner100(Vector3 out)
Vector3
getCorner101(Vector3 out)
Vector3
getCorner110(Vector3 out)
Vector3
getCorner111(Vector3 out)
Matrix4
getTransform()
Get the current transformation matrix.Vector3[]
getVertices()
boolean
intersects(BoundingBox b)
Returns whether the given bounding box is intersecting this oriented bounding box (at least one point in).boolean
intersects(OrientedBoundingBox obb)
Returns whether the given oriented bounding box is intersecting this oriented bounding box (at least one point in).void
mul(Matrix4 transform)
OrientedBoundingBox
set(BoundingBox bounds, Matrix4 transform)
void
setBounds(BoundingBox bounds)
Sets the base bounds of the oriented bounding box as the bounds given, the transform is applied to the vertices.void
setTransform(Matrix4 transform)
-
-
-
Field Detail
-
transform
public final Matrix4 transform
Transform matrix.
-
-
Constructor Detail
-
OrientedBoundingBox
public OrientedBoundingBox()
Constructs a new oriented bounding box with the minimum and maximum vector set to zeros.
-
OrientedBoundingBox
public OrientedBoundingBox(BoundingBox bounds)
Constructs a new oriented bounding box from the given bounding box.- Parameters:
bounds
- The bounding box to copy
-
OrientedBoundingBox
public OrientedBoundingBox(BoundingBox bounds, Matrix4 transform)
Constructs a new oriented bounding box from the given bounding box and transform.- Parameters:
bounds
- The bounding box to copytransform
- The transformation matrix to copy
-
-
Method Detail
-
getVertices
public Vector3[] getVertices()
-
getBounds
public BoundingBox getBounds()
Get the current bounds. Callupdate()
if you manually change this bounding box.
-
setBounds
public void setBounds(BoundingBox bounds)
Sets the base bounds of the oriented bounding box as the bounds given, the transform is applied to the vertices.- Parameters:
bounds
- The bounding box to copy
-
getTransform
public Matrix4 getTransform()
Get the current transformation matrix. Callupdate()
if you manually change this matrix.
-
setTransform
public void setTransform(Matrix4 transform)
-
set
public OrientedBoundingBox set(BoundingBox bounds, Matrix4 transform)
-
contains
public boolean contains(Vector3 v)
Returns whether the given vector is contained in this oriented bounding box.- Parameters:
v
- The vector- Returns:
- Whether the vector is contained or not.
-
contains
public boolean contains(BoundingBox b)
Returns whether the given bounding box is contained in this oriented bounding box.- Parameters:
b
- The bounding box- Returns:
- Whether the given bounding box is contained
-
contains
public boolean contains(OrientedBoundingBox obb)
Returns whether the given oriented bounding box is contained in this oriented bounding box.- Parameters:
obb
- The oriented bounding box- Returns:
- Whether the given oriented bounding box is contained
-
intersects
public boolean intersects(BoundingBox b)
Returns whether the given bounding box is intersecting this oriented bounding box (at least one point in).- Parameters:
b
- The bounding box- Returns:
- Whether the given bounding box is intersected
-
intersects
public boolean intersects(OrientedBoundingBox obb)
Returns whether the given oriented bounding box is intersecting this oriented bounding box (at least one point in).- Parameters:
obb
- The oriented bounding box- Returns:
- Whether the given bounding box is intersected
-
mul
public void mul(Matrix4 transform)
-
-