BoundingBox class

From Solid Graphics Wiki

(Redirected from BoundingBox)
Jump to: navigation, search
BoundingBox class
Namespace: SKL3D
Base type: (None)
Include: Skl3D.h
Lib (Release): SKL.lib
Lib (Debug): SKL_D.lib

The BoundingBox class specifies axis alligned bounding box in 3D space. The class is used mainly for purposes of coarse collision detection tests.


Constructors

Default BoundingBox class constructor does not initialize the bounding box field to any value. This is on purpose for performance reasons. Use Initialize method to set the bounding box object into "empty" state. Use Set method to set bounding box values to the state you want..

Fields

Field name Type Description
minX float Minimimum bounding box's X coordinate
manX float Maximim bounding box's X coordinate
minY float Minimimum bounding box's Y coordinate
manY float Maximim bounding box's Y coordinate
minZ float Minimimum bounding box's Z coordinate
manZ float Maximim bounding box's Z coordinate

Field name Type Description
universeBoundingBox BoundingBox A static variable of BoundingBox type. The universeBoundingBox has all it's min fields initialized to -FLT_MAX and max fields to FLT_MAX. It represents biggest bounding box possible and all Intersects method calls using it will return true.

Methods

Method name Description
Initialize Initialize bounding box into "empty" state. In the "empty" state all min bounding box fields are set to FLT_MAX value and all max fields are set to -FLT_MAX value. This assures that all bounding box's Intersect method calls will return false indicating no intersection with the box.
Set Set's object's field values to specified parameters.
Add Extends bounding box to include specified parameter's bounding box. The Add method is overloaded to take various parameter types, such as point, PointList, TriangleByRefList, Shape, PolyLine, BoundingBox, a shape transformaed by given Matrix4x4f. If the bounding box already encloses the specified parameter's bounding box then the function does nothing.
AddSphere Extends bounding box to include specified spere parameter. If the bounding box already encloses the specified sphere then the function does nothing.
MakeCube If the bounding box is not already a cube then the method extends it to make it a cube.
Intersects Returns true if specified object intersects, touches, or lies inside the bounding box. The method is overloaded and can take Point, BoundingBox, LineSegment type as a parameter. Otherwise returns false.
IsInside Returns true if the bounding box instance is inside specified bounding box parameter. Otherwise returns false.
IsTouching Returns true if another bounding box boundary is within cMinDistance of the bounding box instance.
Move Moves the bounding box by specified vector.
Expand Expands the bounding box by specified size.
Scale Multiplies bounding box by specified factor.
MaxExtent Returns maximum extend of the bonding box. For example if the box is longes in the X dimension then the method returns value of maxX minus minX.
BoundingSphereRadius Returns radius of a minimum sized bounding sphere which completely encloses the bounding box.
Center Returns center point of the bounding box.
GetShape Returns bounding box as a shape object.
IsEmpty Returns true if the bounding box is an "empty" bounding box. Otherwise returns false.

Operators

const float* Returns const pointer to the eight float field values of the bounding box instance.
float* Returns const pointer to the eight float field values of the bounding box instance.

See Also


   


SolidKit Library Documentation

Personal tools