AnyCAD Rapid API 2023
Help you to create a better world!
AxisAlignedBox Class Reference

Classes

class  CornerEnum
 
class  Extent
 

Public Member Functions

 AxisAlignedBox (AxisAlignedBox.Extent e)
 
 AxisAlignedBox (AxisAlignedBox rkBox)
 
 AxisAlignedBox (Vector3 min, Vector3 max)
 
 AxisAlignedBox (float mx, float my, float mz, float Mx, float My, float Mz)
 
Vector3 getMinimum ()
 
Vector3 getMaximum ()
 
void setMinimum (Vector3 vec)
 
void setMinimum (float x, float y, float z)
 
void setMinimumX (float x)
 
void setMinimumY (float y)
 
void setMinimumZ (float z)
 
void setMaximum (Vector3 vec)
 
void setMaximum (float x, float y, float z)
 
void setMaximumX (float x)
 
void setMaximumY (float y)
 
void setMaximumZ (float z)
 
void setExtents (Vector3 min, Vector3 max)
 
void setExtents (float mx, float my, float mz, float Mx, float My, float Mz)
 
Vec3List getAllCorners ()
 
Vector3 getCorner (AxisAlignedBox.CornerEnum cornerToGet)
 
void merge (AxisAlignedBox rhs)
 
void merge (Vector3 point)
 
Vector3 matPlusVec3 (Matrix4 m, Vector3 v)
 
void transform (Matrix4 matrix)
 
void setNull ()
 
boolean isNull ()
 
boolean isFinite ()
 
void setInfinite ()
 
boolean isInfinite ()
 
boolean intersects (AxisAlignedBox b2)
 
AxisAlignedBox intersection (AxisAlignedBox b2)
 
float volume ()
 
void scale (Vector3 s)
 
boolean intersects (Sphere s)
 
boolean intersects (Plane p)
 
boolean intersects (Vector3 v)
 
Vector3 getCenter ()
 
Vector3 getSize ()
 
Vector3 getHalfSize ()
 
boolean contains (Vector3 v)
 
float squaredDistance (Vector3 v)
 
float distance (Vector3 v)
 
boolean contains (AxisAlignedBox other)
 

Static Public Member Functions

static AxisAlignedBox getBOX_NULL ()
 
static AxisAlignedBox getBOX_INFINITE ()
 

Detailed Description

A 3D box aligned with the x/y/z axes.
Remarks:
This class represents a simple box which is aligned with the
axes. Internally it only stores 2 points as the extremeties of
the box, one which is the minima of all 3 axes, and the other
which is the maxima of all 3 axes. This class is typically used
for an axis-aligned bounding box (AABB) for collision and
visibility determination.

Member Function Documentation

◆ contains() [1/2]

boolean AxisAlignedBox.contains ( AxisAlignedBox  other)

Tests whether another box contained by this box.

◆ contains() [2/2]

boolean AxisAlignedBox.contains ( Vector3  v)

Tests whether the given point contained by this box.

◆ distance()

float AxisAlignedBox.distance ( Vector3  v)

Returns the minimum distance between a given point and any part of the box.

◆ getAllCorners()

Vec3List AxisAlignedBox.getAllCorners ( )

Returns a pointer to an array of 8 corner points, useful for
collision vs. non-aligned objects.
Remarks:
If the order of these corners is important, they are as
follows: The 4 points of the minimum Z face (note that
because Ogre uses right-handed coordinates, the minimum Z is
at the 'back' of the box) starting with the minimum point of
all, then anticlockwise around this face (if you are looking
onto the face from outside the box). Then the 4 points of the
maximum Z face, starting with maximum point of all, then
anticlockwise around this face (looking onto the face from
outside the box). Like this:


1-------2
| /|
| / |
5-------4 |
| 0----|--3
| / | /
|/ |/
6-------7

◆ getCenter()

Vector3 AxisAlignedBox.getCenter ( )

Gets the centre of the box

◆ getCorner()

Vector3 AxisAlignedBox.getCorner ( AxisAlignedBox.CornerEnum  cornerToGet)

Gets the position of one of the corners

◆ getHalfSize()

Vector3 AxisAlignedBox.getHalfSize ( )

Gets the half-size of the box

◆ getMaximum()

Vector3 AxisAlignedBox.getMaximum ( )

Gets the maximum corner of the box.

◆ getMinimum()

Vector3 AxisAlignedBox.getMinimum ( )

Gets the minimum corner of the box.

◆ getSize()

Vector3 AxisAlignedBox.getSize ( )

Gets the size of the box

◆ intersection()

AxisAlignedBox AxisAlignedBox.intersection ( AxisAlignedBox  b2)

Calculate the area of intersection of this box and another

◆ intersects() [1/4]

boolean AxisAlignedBox.intersects ( AxisAlignedBox  b2)

Returns whether or not this box intersects another.

◆ intersects() [2/4]

boolean AxisAlignedBox.intersects ( Plane  p)

Tests whether this box intersects a plane.

◆ intersects() [3/4]

boolean AxisAlignedBox.intersects ( Sphere  s)

Tests whether this box intersects a sphere.

◆ intersects() [4/4]

boolean AxisAlignedBox.intersects ( Vector3  v)

Tests whether the vector point is within this box.

◆ isFinite()

boolean AxisAlignedBox.isFinite ( )

Returns true if the box is finite.

◆ isInfinite()

boolean AxisAlignedBox.isInfinite ( )

Returns true if the box is infinite.

◆ isNull()

boolean AxisAlignedBox.isNull ( )

Returns true if the box is null i.e. empty.

◆ matPlusVec3()

Vector3 AxisAlignedBox.matPlusVec3 ( Matrix4  m,
Vector3  v 
)

Transforms the box according to the matrix supplied.
Remarks:
By calling this method you get the axis-aligned box which
surrounds the transformed version of this box. Therefore each
corner of the box is transformed by the matrix, then the
extents are mapped back onto the axes to produce another
AABB. Useful when you have a local AABB for an object which
is then transformed.

◆ merge() [1/2]

void AxisAlignedBox.merge ( AxisAlignedBox  rhs)

Merges the passed in box into the current box. The result is the
box which encompasses both.

◆ merge() [2/2]

void AxisAlignedBox.merge ( Vector3  point)

Extends the box to encompass the specified point (if needed).

◆ scale()

void AxisAlignedBox.scale ( Vector3  s)

Scales the AABB by the vector given.

◆ setExtents()

void AxisAlignedBox.setExtents ( Vector3  min,
Vector3  max 
)

Sets both minimum and maximum extents at once.

◆ setInfinite()

void AxisAlignedBox.setInfinite ( )

Sets the box to 'infinite'

◆ setMaximum()

void AxisAlignedBox.setMaximum ( Vector3  vec)

Sets the maximum corner of the box.

◆ setMaximumX()

void AxisAlignedBox.setMaximumX ( float  x)

Changes one of the components of the maximum corner of the box
used to resize only one dimension of the box

◆ setMinimum()

void AxisAlignedBox.setMinimum ( Vector3  vec)

Sets the minimum corner of the box.

◆ setMinimumX()

void AxisAlignedBox.setMinimumX ( float  x)

Changes one of the components of the minimum corner of the box
used to resize only one dimension of the box

◆ setNull()

void AxisAlignedBox.setNull ( )

Transforms the box according to the affine matrix supplied.
Remarks:
By calling this method you get the axis-aligned box which
surrounds the transformed version of this box. Therefore each
corner of the box is transformed by the matrix, then the
extents are mapped back onto the axes to produce another
AABB. Useful when you have a local AABB for an object which
is then transformed.
Sets the box to a 'null' value i.e. not a box.

◆ squaredDistance()

float AxisAlignedBox.squaredDistance ( Vector3  v)

Returns the squared minimum distance between a given point and any part of the box.
This is faster than distance since avoiding a squareroot, so use if you can.

◆ volume()

float AxisAlignedBox.volume ( )

Calculate the volume of this box