This page has been translated automatically.
Programming
Fundamentials
Setting Up Development Environment
UnigineScript
High-Level Systems
C++
C#
UUSL (Unified UNIGINE Shader Language)
File Formats
Rebuilding the Engine and Tools
GUI
Double Precision Coordinates
API
Containers
Controls-Related Classes
Core Library
Engine-Related Classes
GUI-Related Classes
Node-Related Classes
Pathfinding-Related Classes
Physics-Related Classes
Plugins-Related Classes
Rendering-Related Classes
Utility Classes
Warning! This version of documentation is OUTDATED, as it describes an older SDK version! Please switch to the documentation for the latest SDK version.
Warning! This version of documentation describes an old SDK version which is no longer supported! Please upgrade to the latest SDK version.

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 Class

Members


BoundBox ()

Constructor. Creates an empty bounding box.

BoundBox (variable v)

Constructor. Creates a bounding box initialized by one of the following:
  • BoundBox - the bounding box.
  • BoundSphere - the bounding sphere.

Arguments

  • variable v - Variable of one of the following types:
    • BoundBox bb - The bounding box.
    • BoundSphere bs - The bounding sphere.

BoundBox (variable v0, variable v1)

Constructor. Creates a bounding box initialized by one of the following:
  • vec3 and vec3 - minimum and maximum coordinates of the bounding box respectively.
  • BoundBox and mat4 - the bounding box and its transformation matrix.

Arguments

  • variable v0 - Argument of one of the following types:
    • vec3 min - Bounding box minimum coordinates.
    • BoundBox bb - The bounding box.
  • variable v1 - Argument of one of the following types:
    • vec3 max - Bounding box maximum coordinates.
    • mat4 transform - Transformation matrix.

void expand (variable v)

Depending on the received arguments, the function performs the following:
  • If the vec3 is passed, the function expands the current bounding box so that the point with the given coordinates is inside this bounding box.
  • If the BoundSphere is passed, the function expands the current bounding box so that it can be described around the given bounding sphere.
  • If the BoundBox is passed, the function expands the current bounding box so that it can be described around the given bounding box.

Arguments

  • variable v - Argument of one of the following types:
    • vec3 point - Coordinates of the point.
    • BoundSphere bs - The bounding sphere.
    • BoundBox bb - The bounding box.

vec3 getMax ()

Returns the maximum coordinates of the bounding box.

Return value

Bounding box maximum coordinates.

vec3 getMin ()

Returns the minimum coordinates of the bounding box.

Return value

Bounding box minimum coordinates.

int insideAll (variable v)

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

Arguments

  • variable v - Argument of one of the following types:
    • BoundSphere bs - The bounding box.
    • BoundBox bb - The bounding sphere.

Return value

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

int inside (variable v)

Depending on the variable passed as an argument, the function performs the following:
  • If the vec3 is passed, the function checks if the given point is inside the current bounding box.
  • If the BoundBox is passed, the function checks if the given bounding box is inside the current bounding box.
  • If the BoundSphere is passed, the function checks if the given bounding sphere is inside the current bounding box.

Arguments

  • variable v - Argument of one of the following types:
    • vec3 point - Coordinates of the point.
    • BoundBox bb - The bounding box.
    • BoundSphere bs - The bounding sphere.

Return value

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

int inside (variable v0, variable v1)

Checks if the specified sphere or box is inside the current bounding box. Variables, passed as arguments, can be the following:
  • vec3 point and float radius
  • vec3 min and vec3 max

Arguments

  • variable v0 - Argument of one of the following types:
    • vec3 point - Coordinates of the sphere center.
    • vec3 min - Bounding box minimum coordinates.
  • variable v1 - Argument of one of the following types:
    • float radius - The sphere radius.
    • vec3 max - Bounding box maximum coordinates.

Return value

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

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 coordinates are valid; otherwise, 0.

void setTransform (mat4 transform)

Sets the transformation matrix for the current bounding box.

Arguments

  • mat4 transform - Transformation matrix.

void set (variable v0, variable v1)

Sets the bounding box. The function can receive the following arguments:
  • vec3 and vec3 - bounding box minimum and maximum coordinates.
  • BoundBox and mat4 - bounding box and its transformation matrix.

Arguments

  • variable v0 - Argument of one of the following types:
    • vec3 min - Bounding box minimum coordinates.
    • BoundBox bb - The bounding box.
  • variable v1 - Argument of one of the following types:
    • vec3 max - Bounding box maximum coordinates.
    • mat4 transform - Transformation matrix of the bounding box

void set (variable v)

Sets the bounding box by the given bounding sphere or the bounding box.

Arguments

  • variable v - Argument of one of the following types:
    • BoundSphere bs - The bounding sphere.
    • BoundBox bb - The bounding box.

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

Initialization by minimum and maximum coordinates of the bounding box.

Arguments

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

BoundBox (const BoundBox & bb)

Initialization by the bounding box.

Arguments

  • const BoundBox & bb - The bounding box.

explicit BoundBox (const BoundSphere & bs)

Initialization by the bounding sphere.

Arguments

  • const BoundSphere & bs - The bounding sphere.

~BoundBox ()

Destructor.

void clear ()

Clears the bounding box.

void set (const vec3 & min, const vec3 & max)

Sets the bounding box by its minimum and maximum coordinates.

Arguments

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

void set (const BoundSphere & bs)

Sets the bounding box by the bounding sphere.

Arguments

  • const BoundSphere & bs - The bounding sphere.

void set (const BoundBox & bb)

Sets the bounding box.

Arguments

  • const BoundBox & bb - The bounding box.

int inside (const vec3 & point, float radius) const

Checks if the sphere is inside the bounding box.

Arguments

  • const vec3 & point - The coordinates of the center of the sphere.
  • float radius - The sphere radius.

Return value

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

int inside (const vec3 & min, const vec3 & max) const

Checks if the box is inside the bounding box.

Arguments

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

Return value

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

int inside (const BoundSphere & bs) const

Checks if the bounding sphere is inside the bounding box.

Arguments

  • const BoundSphere & bs - The bounding sphere.

Return value

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

int inside (const BoundBox & bb) const

Checks if the bounding box is inside the bounding box.

Arguments

  • const BoundBox & bb - The bounding box.

Return value

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

UNIGINE_INLINE int isValid () const

Checks the bounding box status.

Return value

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

UNIGINE_INLINE const vec3 & getMin () const

Gets the minimum coordinates of the bounding box.

Return value

The bounding box minimum coordinates.

UNIGINE_INLINE const vec3 & getMax () const

Gets the maximum coordinates of the bounding box

Return value

The bounding box maximum coordinates.
Last update: 2017-07-03
Build: ()