Unigine::BoundBox Class

This class serves to construct the bounding box in single precision coordinates.

Notice
Instances of this class are deleted automatically when it is necessary.

In case of double precision coordinates, the bounding box should be constructed by using the WorldBoundBox class. It includes the same functions as the BoundBox class, but its functions deal with the double precision coordinates.

Notice
To support both single and double precision builds, you can use the WorldBoundBox class only. The engine will automatically substitute it with the BoundBox if it is required.

BoundBox ( ) #

Constructor. Creates an empty bounding box.

BoundBox ( const vec3 & min, const vec3 & max ) #

Initialization by minimum and maximum coordinates of the bounding box.

Arguments

• const vec3 & min - Bounding box minimum coordinates.
• const vec3 & max - Bounding box maximum coordinates.

BoundBox ( const BoundBox & bb ) #

Initialization by the bounding box.

Arguments

• const BoundBox & bb - Bounding box.

explicit BoundBox ( const BoundSphere & bs ) #

Initialization by the bounding sphere.

Arguments

• const BoundSphere & bs - Bounding sphere.

voidset ( const vec3 & min, const vec3 & max ) #

Sets the bounding box by its minimum and maximum coordinates.

Arguments

• const vec3 & min - Bounding box minimum coordinates.
• const vec3 & max - Bounding box maximum coordinates.

voidset ( const BoundSphere & bs ) #

Sets the bounding box by the bounding sphere.

Arguments

• const BoundSphere & bs - Bounding sphere.

voidset ( const BoundBox & bb ) #

Sets the bounding box equal to the specified source bounding box.

Arguments

• const BoundBox & bb - Source bounding box.

voidset ( const vec3 * points, int num_points ) #

Sets the bounding box by the coordinates of points in space to be enclosed by it.

Arguments

• const vec3 * points - List of points to be enclosed by the bounding box.
• int num_points - Number of points to be enclosed by the bounding box.

const vec3 &getMax ( ) # const

Returns the maximum coordinates of the bounding box.

Return value

Bounding box maximum coordinates.

const vec3 &getMin ( ) # const

Returns the minimum coordinates of the bounding box.

Return value

Bounding box minimum coordinates.

voidsetTransform ( const mat4 & transform ) #

Sets the given transformation matrix to the bounding box.

Arguments

• const mat4 & transform - Transformation matrix.

voidsetTransform ( const dmat4 & transform ) #

Sets the given transformation matrix to the bounding box.

Arguments

• const dmat4 & transform - Transformation matrix.

intisValid ( ) # const

Checks the bounding box status.

Return value

1 if the bounding box minimum and maximum coordinates are valid; otherwise, 0.

voidclear ( ) #

Clears the bounding box.

voidexpand ( const BoundSphere & bs ) #

Expands the current bounding box to enclose the given bounding sphere.

Arguments

• const BoundSphere & bs - Bounding sphere.

voidexpand ( const BoundBox & bb ) #

Expands the current bounding box to enclose the given bounding box.

Arguments

• const BoundBox & bb - Bounding box.

voidexpand ( const vec3 & point ) #

Expands the current bounding box to enclose the given point.

Arguments

• const vec3 & point - Point coordinates.

voidexpand ( const vec3 * points, int num_points ) #

Expands the current bounding box to enclose all given points.

Arguments

• const vec3 * points - List of points to be enclosed by the bounding box.
• int num_points - Number of points to be enclosed by the bounding box.

intinside ( const vec3 & point, float radius ) # const

Checks if the sphere is inside the bounding box.

Arguments

• const vec3 & point - Coordinates of the center of the sphere.

Return value

1 if the sphere is inside the bounding box; otherwise, 0.

intinside ( const vec3 & min, const vec3 & max ) # const

Checks if the box is inside the bounding box.

Arguments

• const vec3 & min - Box minimum coordinates.
• const vec3 & max - Box maximum coordinates.

Return value

1 if the box is inside the bounding box; otherwise, 0.

intinside ( const BoundSphere & bs ) # const

Checks if the bounding sphere is inside the bounding box.

Arguments

• const BoundSphere & bs - Bounding sphere.

Return value

1 if the bounding sphere is inside the bounding box; otherwise, 0.

intinside ( const BoundBox & bb ) # const

Checks if the bounding box is inside the bounding box.

Arguments

• const BoundBox & bb - Bounding box.

Return value

1 if the bounding box is inside the bounding box; otherwise, 0.

intinsideAll ( const BoundBox & bb ) #

Checks if the whole given bounding box is inside the current bounding box.

Arguments

• const BoundBox & bb - Bounding box.

Return value

1 if the whole bounding box is inside the bounding box; otherwise, 0.

intinsideAll ( const BoundSphere & bs ) #

Checks if the given bounding sphere is inside the current bounding box.

Arguments

• const BoundSphere & bs - Bounding sphere.

Return value

1 if the whole bounding sphere is inside the bounding box; otherwise, 0.
Last update: 2019-07-18