Axis Aligned Bounding Box

AABB

Provides functions to calculate and manipulate Axis-Aligned Bounding Boxes (AABB).

AABB are a simple 3D rectangle with no orientation. It is up to the user to provide translation.

An AABB is represented by an array of 2 x 3D vectors. The first vector represents the minimum extent. The second vector represents the maximum extent.

It should be noted that rotating the object within an AABB will invalidate the AABB. It is up to the user to either:

  • recalculate the AABB.
  • use an AAMBB instead.

TODO: add transform( matrix )

pyrr.aabb.add_aabbs(*args, **kwargs)

Extend an AABB to encompass a list of other AABBs.

pyrr.aabb.add_points(*args, **kwargs)

Extends an AABB to encompass a list of points.

pyrr.aabb.centre_point(*args, **kwargs)

Returns the centre point of the AABB.

pyrr.aabb.clamp_points(*args, **kwargs)

Takes a list of points and modifies them to fit within the AABB.

pyrr.aabb.create_from_aabbs(*args, **kwargs)

Creates an AABB from a list of existing AABBs.

AABBs must be a 2D list. Ie::
numpy.array([
AABB, AABB, ])
pyrr.aabb.create_from_bounds(*args, **kwargs)

Creates an AABB using the specified minimum and maximum values.

pyrr.aabb.create_from_points(*args, **kwargs)

Creates an AABB from the list of specified points.

Points must be a 2D list. Ie::
numpy.array([
[ x, y, z ], [ x, y, z ], ])
pyrr.aabb.create_zeros(dtype=None)
class pyrr.aabb.index
maximum = 1
minimum = 0
pyrr.aabb.maximum(*args, **kwargs)

Returns the maximum point of the AABB.

pyrr.aabb.minimum(*args, **kwargs)

Returns the minimum point of the AABB.

AAMBB

Provides functions to calculate and manipulate Axis-Aligned Minimum Bounding Boxes (AAMBB).

AAMBB are a simple 3D rectangle with no orientation. It is up to the user to provide translation. AAMBB differ from AABB in that they allow for the content to rotate freely and still be within the AAMBB.

An AAMBB is represented in the same way an AABB is; a array of 2 x 3D vectors. The first vector represents the minimum extent. The second vector represents the maximum extent.

Note that because the AAMBB set’s it’s dimensions using the vector length of any points set within it, the user should be careful to avoid adding the AAMBB to itself or the AAMBB will continue to grow.

TODO: add transform( matrix ) TODO: add point_within_aabb TODO: use point_within_aabb for unit tests

pyrr.aambb.add_aabbs(*args, **kwargs)

Extend an AAMBB to encompass a list of other AABBs or AAMBBs.

It should be noted that this ensures that the encompassed AABBs can rotate freely. Using the AAMBB itself in this calculation will create an event bigger AAMBB.

pyrr.aambb.add_points(*args, **kwargs)

Extends an AAMBB to encompass a list of points.

It should be noted that this ensures that the encompassed points can rotate freely. Calling this using the min / max points from the AAMBB will create an even bigger AAMBB.

pyrr.aambb.centre_point(bb)

Returns the centre point of the AABB. This should always be [0.0, 0.0, 0.0]

pyrr.aambb.clamp_points(bb, points)

Takes a list of points and modifies them to fit within the AABB.

pyrr.aambb.create_from_aabbs(aabbs, dtype=None)

Creates an AAMBB from a list of existing AABBs.

AABBs must be a 2D list. Ie::
numpy.array([
AABB, AABB, ])
pyrr.aambb.create_from_bounds(*args, **kwargs)

Creates an AAMBB using the specified minimum and maximum values.

pyrr.aambb.create_from_points(*args, **kwargs)

Creates an AAMBB from the list of specified points.

Points must be a 2D list. Ie::
numpy.array([
[ x, y, z ], [ x, y, z ], ])
pyrr.aambb.create_zeros(dtype=None)
class pyrr.aambb.index
maximum = 1
minimum = 0
pyrr.aambb.maximum(bb)

Returns the maximum point of the AABB.

pyrr.aambb.minimum(bb)

Returns the minimum point of the AABB.