Unigine.WorldBoundBox Class
This class serves to construct the bounding box in double precision coordinates.
Bounding boxes has better precision quality but it takes more time for calculation in comparison with bounding spheres.
By using this class you can easily find the common bounding box for several objects by expanding the bounding box.
WorldBoundBox Class
Members
WorldBoundBox()
Default constructor. Creates an empty bounding box.WorldBoundBox(dvec3 min, dvec3 max)
Constructor. Initializes new bounding box by minimum and maximum coordinates of the bounding box.Arguments
- dvec3 min - The bounding box minimum coordinates.
- dvec3 max - The bounding box maximum coordinates.
WorldBoundBox(WorldBoundBox bb)
Constructor. Initializes new bounding box by using given bounding box.Arguments
- WorldBoundBox bb - Bounding box.
WorldBoundBox(WorldBoundSphere bs)
Constructor. Initializes new bounding box by the using given bounding sphere.Arguments
- WorldBoundSphere bs - Bounding sphere.
void set(dvec3 min, dvec3 max)
Sets the bounding box by its minimum and maximum coordinates.Arguments
- dvec3 min - The bounding box minimum coordinates.
- dvec3 max - The bounding box maximum coordinates.
void set(WorldBoundSphere bs)
Sets the bounding box by the bounding sphere.Arguments
- WorldBoundSphere bs - The bounding sphere.
void set(WorldBoundBox bb)
Sets the bounding box.Arguments
- WorldBoundBox bb - The bounding box.
dvec3 getMax()
Gets the maximum coordinates of the bounding boxReturn value
The bounding box maximum coordinates.dvec3 getMin()
Gets the minimum coordinates of the bounding box.Return value
The bounding box minimum coordinates.int isValid()
Checks if the bounding box coordinates are valid (minimum coordinate along the X axis is less or equal to the maximum coordinate along the X axis).Return value
1 if the bounding box minimum and maximum coordinates are valid, otherwise, 0.void clear()
Clears the bounding box.void expand(WorldBoundSphere bs)
Expands the current bounding box for including given bounding sphere.Arguments
- WorldBoundSphere bs - The bounding sphere.
void expand(WorldBoundBox bb)
Expands the current bounding box for including given bounding box.Arguments
- WorldBoundBox bb - The bounding box.
void expand(dvec3 point)
Expands the current bounding box for including given point.Arguments
- dvec3 point
int inside(WorldBoundBox bb)
Checks if the bounding box is inside the bounding box.Arguments
- WorldBoundBox bb - The bounding box.
Return value
1 if the bounding box is inside the bounding box; otherwise, 0.int inside(dvec3 min, dvec3 max)
Checks if the box is inside the bounding box.Arguments
- dvec3 min - The box minimum coordinates.
- dvec3 max - The box maximum coordinates.
Return value
1 if the box is inside the bounding box; otherwise, 0.int inside(WorldBoundSphere bs)
Checks if the bounding sphere is inside the bounding box.Arguments
- WorldBoundSphere bs - The bounding sphere.
Return value
1 if the bounding sphere is inside the bounding box; otherwise, 0.int inside(dvec3 point, double radius)
Checks if the sphere is inside the bounding box.Arguments
- dvec3 point - The coordinates of the center of the sphere.
- double radius - The sphere radius.
Return value
1 if the sphere is inside the bounding box; otherwise, 0.int insideAll(WorldBoundBox bb)
Checks if the whole given bounding box is inside the current bounding box.Arguments
- WorldBoundBox bb - The bounding box.
Return value
1 if the whole box is inside the bounding box; otherwise, 0.int insideAll(WorldBoundSphere bs)
Checks if the whole given bounding sphere is inside the current bounding box.Arguments
- WorldBoundSphere bs - The bounding sphere.
Return value
1 if the whole sphere is inside the bounding box; otherwise, 0.~WorldBoundBox()
Destructor.Last update: 2018-08-10
Help improve this article
Was this article helpful?
(or select a word/phrase and press Ctrl+Enter)