This page has been translated automatically.
UnigineScript
The Language
Core Library
Engine Library
Node-Related Classes
GUI-Related Classes
Plugins Library
High-Level Systems
Samples
Usage Examples
C++ API
API Reference
Integration Samples
Usage Examples
C++ Plugins
Migration
Migrating to UNIGINE 2.0
C++ API Migration
Migrating from UNIGINE 2.0 to UNIGINE 2.1
注意! 这个版本的文档是过时的,因为它描述了一个较老的SDK版本!请切换到最新SDK版本的文档。
注意! 这个版本的文档描述了一个不再受支持的旧SDK版本!请升级到最新的SDK版本。

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.
Last update: 2017-07-03
Build: ()