Box

  • Box is a mathematical representation used for intersection and collision tests with oriented boxes.

  • It provides constructors to create boxes with specified centers and sizes, defaulting to (0,0,0) and (1,1,1) respectively.

  • Public methods allow access and modification of the box's center, rotation, and size.

  • getExtents() calculates and returns a vector representing half the size of the box.

  • makeCopy() creates a copy of the current Box object.

public class Box

Mathematical representation of a box. Used to perform intersection and collision tests against oriented boxes.

Public Constructors

*
Box ()
Create a box with a center of (0,0,0) and a size of (1,1,1).
*
Box ( Vector3 size)
Create a box with a center of (0,0,0) and a specified size.
*
Box ( Vector3 size, Vector3 center)
Create a box with a specified center and size.

Public Methods

Vector3
getCenter ()
Get a copy of the box's center.
Vector3
getExtents ()
Calculate the extents (half the size) of the box.
Quaternion
getRotation ()
Get a copy of the box's rotation.
Vector3
getSize ()
Get a copy of the box's size.
Box
void
setCenter ( Vector3 center)
Set the center of this box.
void
setRotation ( Quaternion rotation)
Set the rotation of this box.
void
setSize ( Vector3 size)
Set the size of this box.

Inherited Methods

Public Constructors

public Box ()

Create a box with a center of (0,0,0) and a size of (1,1,1).

public Box ( Vector3 size)

Create a box with a center of (0,0,0) and a specified size.

Parameters
size
the size of the box.

public Box ( Vector3 size, Vector3 center)

Create a box with a specified center and size.

Parameters
size the size of the box
center the center of the box

Public Methods

public Vector3 getCenter ()

Get a copy of the box's center.

Returns
  • a new vector that represents the box's center

public Vector3 getExtents ()

Calculate the extents (half the size) of the box.

Returns
  • a new vector that represents the box's extents

public Quaternion getRotation ()

Get a copy of the box's rotation.

Returns
  • a new quaternion that represents the box's rotation

public Vector3 getSize ()

Get a copy of the box's size.

Returns
  • a new vector that represents the box's size
See Also

public Box makeCopy ()

public void setCenter ( Vector3 center)

Set the center of this box.

Parameters
center
the new center of the box
See Also

public void setRotation ( Quaternion rotation)

Set the rotation of this box.

Parameters
rotation
the new rotation of the box
See Also

public void setSize ( Vector3 size)

Set the size of this box.

Parameters
size
the new size of the box
See Also
Design a Mobile Site
View Site in Mobile | Classic
Share by: