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
Core Library
Containers
Engine Classes
Node-Related Classes
Rendering-Related Classes
Physics-Related Classes
GUI-Related Classes
Controls-Related Classes
Pathfinding-Related Classes
Utility Classes
Внимание! Эта версия документация УСТАРЕЛА, поскольку относится к более ранней версии SDK! Пожалуйста, переключитесь на самую актуальную документацию для последней версии SDK.
Внимание! Эта версия документации описывает устаревшую версию SDK, которая больше не поддерживается! Пожалуйста, обновитесь до последней версии SDK.

BoundSphere Class (UnigineScript)

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

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

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

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

BoundSphere Class

Members


BoundSphere ()

Constructor. Creates an empty bounding sphere.

BoundSphere (variable v)

Constructor. Creates a bounding sphere 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.

BoundSphere (variable v0, variable v1)

Constructor. Creates a bounding sphere initialized by one of the following:
  • vec3 and float - the center and radius of the bounding sphere.
  • BoundSphere and mat4 - the bounding sphere and its transformation matrix.

Arguments

  • variable v0 - Argument of one of the following types:
    • vec3 point - Coordinates of the sphere center.
    • BoundSphere bs - The bounding sphere.
  • variable v1 - Argument of one of the following types:
    • float radius - Radius of the bounding sphere.
    • mat4 transform - Transformation matrix.

void expand (variable v)

Depending on the variables passed as arguments, the function performs the following:
  • If vec3 is passed, the function expands the current bounding sphere so that the given point is inside this bounding sphere.
  • If BoundSphere is passed, the function expands the current bounding sphere so that it can be described around the given bounding sphere.
  • If BoundBox is passed, the function expands the current bounding sphere 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 getCenter ()

Returns coordinates of the bounding sphere center.

Return value

Coordinates of the sphere center.

float getRadius ()

Returns the radius of the bounding sphere.

Return value

Radius of the sphere.

int insideAll (variable v)

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

Arguments

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

Return value

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

int inside (variable v)

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

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.

Return value

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

int inside (variable v0, variable v1)

Checks if the specified sphere of 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 / box is inside the bounding sphere; otherwise, 0.

int isValid ()

Checks if the bounding sphere radius has a positive value.

Return value

1 if the radius is positive; otherwise, 0.

void setTransform (mat4 transform)

Sets the transformation matrix for the current bounding sphere.

Arguments

  • mat4 transform - Transformation matrix to set.

void set (variable v0, variable v1)

Sets the bounding sphere. The function can receive the following arguments:
  • vec3 and float - coordinates of the sphere center and its radius.
  • BoundSphere and mat4 - the bounding sphere and its transformation matrix.

Arguments

  • variable v0 - Argument of one of the following types:
    • vec3 point - Coordinates of the sphere center.
    • BoundSphere bs - The bounding sphere.
  • variable v1 - Argument of one of the following types:
    • float radius - The bounding sphere radius.
    • mat4 transform - Transformation matrix of the bounding sphere.

void set (variable v)

Depending on the variable passed as an argument, the function sets the bounding sphere 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: 03.07.2017
Build: ()