Unigine.BoundSphere Class
This class serves to construct the bounding sphere in single precision coordinates.
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.
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(BoundSphere bs)
Initialization by the bounding sphere.Arguments
- BoundSphere bs - The bounding sphere.
explicit BoundSphere(BoundBox bb)
Initialization by the bounding box.Arguments
- BoundBox bb - The bounding box.
void set(vec3 center, float radius)
Sets the bounding sphere by its center and radius.Arguments
- vec3 center - The bounding sphere center.
- float radius - The bounding sphere radius.
void set(BoundSphere bs)
Sets the bounding sphere.Arguments
- BoundSphere bs - The bounding sphere.
void set(BoundBox bb)
Sets the bounding sphere by the bounding box.Arguments
- BoundBox bb - The bounding box.
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.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.int inside(vec3 point, float radius) const
Checks if the sphere is inside the bounding sphere.Arguments
- 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(vec3 min, vec3 max) const
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) const
Checks if the bounding sphere is inside the bounding sphere.Arguments
- BoundSphere bs - The bounding sphere.
Return value
1 if the bounding sphere is inside the bounding sphere; otherwise, 0.int inside(BoundBox bb) const
Checks if the bounding box is inside the bounding sphere.Arguments
- BoundBox bb - The bounding box.
Return value
1 if the bounding box is inside the bounding sphere; otherwise, 0.Last update: 2018-08-10
Help improve this article
Was this article helpful?
(or select a word/phrase and press Ctrl+Enter)