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

Unigine::BoundSphere Class

Header:#include <UnigineBounds.h>

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

Initialization by the center and radius of the bounding sphere.

Arguments

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

BoundSphere(const BoundSphere & bs)

Initialization by the bounding sphere.

Arguments

  • const BoundSphere & bs - The bounding sphere.

explicit BoundSphere(const BoundBox & bb)

Initialization by the bounding box.

Arguments

  • const BoundBox & bb - The bounding box.

void set(const vec3 & center, float radius)

Sets the bounding sphere by its center and radius.

Arguments

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

void set(const BoundSphere & bs)

Sets the bounding sphere.

Arguments

  • const BoundSphere & bs - The bounding sphere.

void set(const BoundBox & bb)

Sets the bounding sphere by the bounding box.

Arguments

  • const BoundBox & bb - The bounding box.

const vec3 & getCenter() const

Returns the bounding sphere center.

Return value

The bounding sphere center.

float getRadius() const

Returns the bounding sphere radius.

Return value

The bounding sphere radius.

void setTransform(const mat4 & transform)

Sets the given transformation matrix to bounding sphere.

Arguments

  • const mat4 & transform - Transformation matrix.

void setTransform(const dmat4 & transform)

Sets the given transformation matrix to bounding sphere.

Arguments

  • const dmat4 & transform - Transformation matrix.

int isValid() const

Checks the bounding sphere status.

Return value

1 if the bounding sphere radius has a positive value; otherwise, 0.

void clear()

Clears the bounding sphere.

void expand(const BoundSphere & bs)

Expands the current bounding sphere for including given bounding sphere.

Arguments

  • const BoundSphere & bs - Bounding sphere to be included.

void expand(const BoundBox & bb)

Expands the current bounding sphere for including given bounding box.

Arguments

  • const BoundBox & bb - Bounding box to be included.

void expand(const vec3 & point)

Expands the current bounding sphere for including given point.

Arguments

  • const vec3 & point - Point coordinates to be included.

void expandRadius(const vec3 & point)

Expands the radius of the bounding sphere.
Source code (C++)
float r = length(center - point);
if (center.w < r)
	radius = r;

Arguments

  • const vec3 & point - Point coordinates the end point of radius.

void expandRadius(const BoundSphere & bs)

Expands the radius of the bounding sphere by using the radius of the given bounding sphere.
Source code (C++)
float r = length(bs.center - center) + bs.radius;
if (center.w < r)
	radius = r;

Arguments

  • const BoundSphere & bs - Bounding sphere.

void expandRadius(const BoundBox & bb)

Expands the radius of the bounding sphere by using the max and min points of the given bounding box. It uses the expandRadius method.
Source code (C++)
const vec3 &min = bb.getMin();
const vec3 &max = bb.getMax();
expandRadius(vec3(min.x, min.y, min.z));
expandRadius(vec3(max.x, min.y, min.z));
expandRadius(vec3(min.x, max.y, min.z));
expandRadius(vec3(max.x, max.y, min.z));
expandRadius(vec3(min.x, min.y, max.z));
expandRadius(vec3(max.x, min.y, max.z));
expandRadius(vec3(min.x, max.y, max.z));
expandRadius(vec3(max.x, max.y, max.z));

Arguments

  • const BoundBox & bb - Bounding box.

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

Checks if the sphere is inside the bounding sphere.

Arguments

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

Return value

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

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

Checks if the box is inside the bounding sphere.

Arguments

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

Return value

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

int inside(const BoundSphere & bs) const

Checks if the bounding sphere is inside the bounding sphere.

Arguments

  • const BoundSphere & bs - The bounding sphere.

Return value

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

int inside(const BoundBox & bb) const

Checks if the bounding box is inside the bounding sphere.

Arguments

  • const BoundBox & bb - The bounding box.

Return value

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

int insideAll(const BoundBox & bb)

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

Arguments

  • const BoundBox & bb - Bounding box.

Return value

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

int insideAll(const BoundSphere & bs)

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

Arguments

  • const BoundSphere & bs - Bounding sphere.

Return value

1 if the whole bounding sphere is inside the bounding sphere; otherwise, 0.
Last update: 2018-08-10
Build: ()