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
Properties
dvec3 Center#
Center point of the bounding box.
dvec3 Max#
The maximum coordinates of the bounding box.
dvec3 Min#
The minimum coordinates of the bounding box.
bool 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).
Members
static 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.
WorldBoundBox ( BoundBox bb, dmat4 transform ) #
Arguments
- BoundBox bb
- dmat4 transform
void Clear ( ) #
Clears the bounding box.void Set ( dvec3 min, dvec3 max ) #
Sets the bounding box by its minimum and maximum coordinates.Arguments
- dvec3 min - Minimum coordinates of the bounding box.
- dvec3 max - Maximum coordinates of the bounding box.
void Set ( dvec3[] points ) #
Sets the bounding box by the coordinates of points in space to be enclosed by it.Arguments
- dvec3[] points - Array of points to be enclosed by the bounding box.
void Set ( BoundBox bb, dmat4 transform ) #
Sets the bounding box by the given bounding box with the given transformation matrix taken into account.Arguments
- BoundBox bb - Source bounding box.
- dmat4 transform - Transformation matrix.
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.
void SetTransform ( dmat4 transform ) #
Sets the given transformation matrix to the bounding box.Arguments
- dmat4 transform - Transformation matrix.
int Compare ( WorldBoundBox bb ) #
Compares the current bounding box with the given one.Arguments
- WorldBoundBox bb - The bounding box to compare with.
Return value
1 if the size and position of both bounding boxes are equal; otherwise, 0.void Expand ( dvec3 point ) #
Expands the current bounding box to include the given point.Arguments
- dvec3 point - Coordinates of the point.
void Expand ( dvec3[] points ) #
Expands the current bounding box to enclose all given points.Arguments
- dvec3[] points - Array of points to be enclosed by the bounding box.
void Expand ( WorldBoundSphere bs ) #
Expands the current bounding box to include the given bounding sphere.Arguments
- WorldBoundSphere bs - The bounding sphere.
void Expand ( WorldBoundBox bb ) #
Expands the current bounding box to include the given bounding box.Arguments
- WorldBoundBox bb - The bounding box.
int Inside ( dvec3 point ) #
Checks if the specified point is inside the current bounding box.Arguments
- dvec3 point - Coordinates of the point.
Return value
1 if the point is inside the bounding box; otherwise, 0.int Inside ( dvec3 point, double radius ) #
Checks if the specified sphere is inside the current 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 Inside ( dvec3 min, dvec3 max ) #
Checks if the given box is inside the current bounding box.Arguments
- dvec3 min - Minimum coordinates of the box.
- dvec3 max - Maximum coordinates of the box.
Return value
1 if the box is inside the bounding box; otherwise, 0.int Inside ( WorldBoundSphere bs ) #
Checks if the specified bounding sphere is inside the current bounding box.Arguments
- WorldBoundSphere bs - The bounding sphere.
Return value
1 if the bounding sphere is inside the bounding box; otherwise, 0.int Inside ( WorldBoundBox bb ) #
Checks if the given bounding box is inside the current bounding box.Arguments
- WorldBoundBox bb - The bounding box.
Return value
1 if the bounding 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.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 InsideCube ( int face, dvec3 point ) #
Checks if a face of the current bounding box is inside the cube represented by minimum and maximum coordinates of the bounding box.Arguments
- int face - The face index from 0 to 5.
- dvec3 point - Offset.
Return value
1 if the face is inside the bounding cube; otherwise, 0.int IrayIntersectionValid ( dvec3 p, dvec3 idirection ) #
Checks for an intersection between a ray and the current bounding box. This function uses the inverse direction of the ray, which increases performance.Arguments
- dvec3 p - Starting point of the ray.
- dvec3 idirection - Inverse direction of the ray.
Return value
1 if the given ray intersects the bounding box; otherwise, 0.double DistanceValid ( dvec3 point ) #
Returns the distance from the given point to the closest vertex of the bounding box.Arguments
- dvec3 point - Coordinates of the point.
Return value
Distance from the given point to the closest vertex of the bounding box, in units.Last update:
2020-07-31
Help improve this article
Was this article helpful?
(or select a word/phrase and press Ctrl+Enter)