This page has been translated automatically.
UnigineEditor
Interface Overview
Assets Workflow
Settings and Preferences
Working With Projects
Adjusting Node Parameters
Setting Up Materials
Setting Up Properties
Landscape Tool
Using Editor Tools for Specific Tasks
Extending Editor Functionality
Programming
Fundamentals
Setting Up Development Environment
Usage Examples
UnigineScript
C++
C#
UUSL (Unified UNIGINE Shader Language)
File Formats
Rebuilding the Engine Tools
GUI
Double Precision Coordinates
API
Containers
Common Functionality
Controls-Related Classes
Engine-Related Classes
Filesystem Functionality
GUI-Related Classes
Node-Related Classes
Objects-Related Classes
Networking Functionality
Pathfinding-Related Classes
Physics-Related Classes
Plugins-Related Classes
IG Plugin
CIGIConnector Plugin
Rendering-Related 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.

BoundSphere Class

Warning
The scope of applications for UnigineScript is limited to implementing materials-related logic (material expressions, scriptable materials, brush materials). Do not use UnigineScript as a language for application logic, please consider C#/C++ instead, as these APIs are the preferred ones. Availability of new Engine features in UnigineScipt (beyond its scope of applications) is not guaranteed, as the current level of support assumes only fixing critical issues.

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 ( vec3 center, float radius ) #

Initialization by the center and radius of the bounding sphere.

Arguments

  • vec3 center - The bounding sphere center.
  • float radius - The bounding sphere radius.

BoundSphere ( vec3[] points, int optimal ) #

Initialization by the array of points.

Arguments

  • vec3[] points - Array of points.
  • int optimal - Flag defining if the optimal sphere should be used. If 0, the sphere will be expanded for including all the given points.

BoundSphere ( BoundSphere bs ) #

Initialization by the bounding sphere.

Arguments

  • BoundSphere bs - The bounding sphere.

BoundSphere ( BoundSphere bs, mat4 transform ) #

Initialization by the bounding sphere and setting the given transformation matrix to the new bounding sphere.

Arguments

  • BoundSphere bs - The bounding sphere.
  • mat4 transform - Transformation matrix.

void clear ( ) #

Clears the bounding sphere.

void set ( vec3 center, float radius ) #

Sets the bounding sphere by its center and radius.

Arguments

  • vec3 center - Center of the bounding sphere.
  • float radius - Radius of the bounding sphere.

void set ( vec3[] points, int optimal ) #

Set the bounding sphere by an array of points.

Arguments

  • vec3[] points - Array of points.
  • int optimal - Flag defining if the optimal sphere should be used. If 0, the sphere will be expanded for including all the given points.

void set ( BoundSphere bs ) #

Sets the bounding sphere.

Arguments

  • BoundSphere bs - Bounding sphere.

void set ( BoundSphere bs, mat4 transform ) #

Sets the bounding sphere by a bounding sphere with a transformation matrix taken into account.

Arguments

  • BoundSphere bs - Bounding sphere.
  • mat4 transform - Transformation matrix.

void set ( BoundBox bb ) #

Sets the bounding sphere by the bounding box.

Arguments

  • BoundBox bb - Bounding box.

void setTransform ( mat4 transform ) #

Sets the given transformation matrix to bounding sphere.

Arguments

  • mat4 transform - Transformation matrix.

void setTransform ( dmat4 transform ) #

Sets the given transformation matrix to bounding sphere.

Arguments

  • dmat4 transform - Transformation matrix.

int compare ( BoundSphere bs ) #

Compares the bounding sphere with the given one. The degree of precision is equal to 1.0e-6f.

Arguments

  • BoundSphere bs - The bounding sphere to compare with.

Return value

1 if the radii and the centers of both bounding spheres are equal; otherwise, 0.

void expand ( vec3 point ) #

Expands the current bounding sphere to include the given point.

Arguments

  • vec3 point - Coordinates of the point.

void expand ( vec3[] points ) #

Expands the current bounding sphere to include the given points.

Arguments

  • vec3[] points - Array of points.

void expand ( BoundSphere bs ) #

Expands the current bounding sphere to include the given bounding sphere.

Arguments

  • BoundSphere bs - Bounding sphere to be included.

void expand ( BoundBox bb ) #

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

Arguments

  • BoundBox bb - Bounding box to be included.

void expandRadius ( vec3 point ) #

Expands the radius of the bounding sphere.

Arguments

  • vec3 point - Point coordinates setting the end point of radius.

void expandRadius ( vec3[] points ) #

Expands the radius of the current bounding sphere to include all points of the array.

Arguments

  • vec3[] points - Array of points.

void expandRadius ( BoundSphere bs ) #

Expands the radius of the bounding sphere by using the radius of the given bounding sphere.

Arguments

  • BoundSphere bs - Bounding sphere.

void expandRadius ( BoundBox bb ) #

Expands the radius of the bounding sphere by using the max and min points of the given bounding box.

Arguments

  • BoundBox bb - Bounding box.

int inside ( vec3 point ) #

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

Arguments

  • vec3 point - Point coordinates.

Return value

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

int inside ( vec3 point, float radius ) #

Checks if the sphere is inside the bounding sphere.

Arguments

  • vec3 point - Center of the sphere.
  • float radius - Radius of the sphere.

Return value

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

int inside ( vec3 min, vec3 max ) #

Checks if the box is inside the bounding sphere.

Arguments

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

Return value

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

int inside ( BoundSphere bs ) #

Checks if the specified bounding sphere is inside the bounding sphere.

Arguments

  • BoundSphere bs - Bounding sphere.

Return value

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

int inside ( BoundBox bb ) #

Checks if the bounding box is inside the bounding sphere.

Arguments

  • BoundBox bb - Bounding box.

Return value

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

int insideAll ( BoundSphere bs ) #

Checks if the whole specified bounding sphere is inside the current bounding sphere.

Arguments

  • BoundSphere bs - Bounding sphere.

Return value

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

int insideAll ( BoundBox bb ) #

Checks if the whole specified bounding box is inside the current bounding sphere.

Arguments

  • BoundBox bb - Bounding box.

Return value

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

int rayIntersection ( vec3 point, vec3 direction ) #

Checks for an intersection of a ray with the current bounding sphere.

Arguments

  • vec3 point - The starting point of the ray.
  • vec3 direction - The direction vector of the ray.

Return value

1 if an intersection has occurred; otherwise, 0.

int getIntersection ( vec3 p0, vec3 p1 ) #

Checks for an intersection of a line with the current bounding sphere.

Arguments

  • vec3 p0 - The starting point of the line.
  • vec3 p1 - The ending point of the line.

Return value

1 if an intersection has occurred; otherwise, 0.

float distance ( vec3 point ) #

Returns the distance from the given point to the closest point of the current bounding sphere.

Arguments

  • vec3 point - Coordinates of the point.

Return value

Distance from the point, in units.

vec3 getCenter ( ) #

Returns the bounding sphere center.

Return value

Bounding sphere center.

float getRadius ( ) #

Returns the bounding sphere radius.

Return value

The bounding sphere radius.

bool isValid ( ) #

Checks the bounding sphere status.

Return value

true if the bounding sphere radius has a positive value; otherwise, false.
Last update: 2020-07-31
Build: ()