# Unigine.WorldBoundSphere Struct

Notice
The functions listed below are the members of the Unigine.MathLib namespace.

## voidSet ( BoundSphere bs ) #

Sets the value using the specified argument(s).

## WorldBoundSphereoperator* ( dmat4 m, WorldBoundSphere bs ) #

Multiplies the matrix by the bounding sphere and returns the resulting bounding sphere.

### Return value

Resulting bounding sphere.

## voidSet ( dvec3 center, double radius ) #

Sets the bounding sphere using the specified argument(s).

### Arguments

• dvec3 center - The bounding sphere center.

## voidSet ( dvec3[] points, bool optimal ) #

Sets the bounding sphere using the specified arguments.

### Arguments

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

## voidSet ( WorldBoundSphere bs ) #

Sets the bounding sphere using the specified arguments.

## voidSet ( WorldBoundSphere bs, dmat4 transform ) #

Sets the bounding sphere using the specified arguments.

## voidSet ( WorldBoundBox bb ) #

Sets the bounding sphere by the bounding box.

## voidClear ( ) #

Clears the bounding sphere by setting all components/elements to 0.

## boolEquals ( WorldBoundSphere other ) #

Checks if the bounding sphere and the specified argument are equal considering the predefined accuracy (epsilon).

### Return value

true if the radii and the centers of both bounding spheres are equal; otherwise, false.

## boolEqualsNearly ( WorldBoundSphere other, double epsilon ) #

Checks if the bounding sphere and the specified argument represent the same value with regard to the specified accuracy (epsilon).

### Arguments

• WorldBoundSphere other - Bounding sphere to be checked for equality.
• double epsilon - Epsilon value, that determines accuracy of comparison.

### Return value

true if the radii and the centers of both bounding spheres are equal; otherwise, false.

## boolEquals ( object obj ) #

Checks if the bounding sphere and the specified argument are equal considering the predefined accuracy (epsilon).

### Arguments

• object obj - Object to be checked for equality.

### Return value

true if the object and the bounding sphere are equal; otherwise, false.

## intGetHashCode ( ) #

Returns a hash code for the current object. Serves as the default hash function.

Hash code.

## voidSetTransform ( dmat4 transform ) #

Sets the given transformation matrix to bounding sphere.

### Arguments

• dmat4 transform - Transformation matrix (dmat4) to be set.

## voidExpand ( dvec3 point ) #

Expands the current bounding sphere to include the given point.

### Arguments

• dvec3 point - Coordinates of the point.

## voidExpand ( dvec3[] points ) #

Expands the current bounding sphere for including all points in the array.

### Arguments

• dvec3[] points - Array of points.

## voidExpand ( BoundSphere bs ) #

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

## voidExpand ( WorldBoundBox bb ) #

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

## voidExpandRadius ( dvec3 point ) #

Expands the radius of the bounding sphere.

### Arguments

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

## voidExpandRadius ( dvec3[] points ) #

Expands the radius of the current bounding sphere for including all points of the array.

### Arguments

• dvec3[] points - Array of points.

## voidExpandRadius ( WorldBoundSphere bs ) #

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

## voidExpandRadius ( WorldBoundBox bb ) #

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

## boolInside ( dvec3 point ) #

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

### Arguments

• dvec3 point - Point coordinates.

### Return value

true if the given point is inside the bounding sphere; otherwise, false.

## boolInside ( dvec3 point, double radius ) #

Checks if the sphere defined by the arguments is inside the bounding sphere.

### Arguments

• dvec3 point - Center of the sphere.

### Return value

true if the sphere is inside the bounding sphere; otherwise, false.

## boolInside ( dvec3 min, dvec3 max ) #

Checks if the box specified by the arguments is inside the bounding sphere.

### Arguments

• dvec3 min - Minimum coordinates of the box (lower limit).
• dvec3 max - Maximum coordinates of the box (upper limit).

### Return value

true if the box is inside the bounding sphere; otherwise, false.

## boolInsideValid ( dvec3 point ) #

Checks if the given point is inside the current bounding sphere.
Notice
The method doesn't check if the current bounding sphere is valid.

### Arguments

• dvec3 point - Point coordinates.

### Return value

true if the given point is inside the bounding sphere; otherwise, false.

## boolInsideValid ( dvec3 point, double radius ) #

Checks if the sphere specified in the argument is inside the current bounding sphere.
Notice
The method doesn't check if the current bounding sphere is valid.

### Arguments

• dvec3 point - Cente of the sphere.

### Return value

true if the sphere is inside the bounding sphere; otherwise, false.

## boolInsideValid ( dvec3 min, dvec3 max ) #

Checks if the box specified in the argument is inside the current bounding sphere.
Notice
The method doesn't check if the current bounding sphere is valid.

### Arguments

• dvec3 min - Minimum coordinates of the box (lower limit).
• dvec3 max - Maximum coordinates of the box (upper limit).

### Return value

true if the box is inside the bounding sphere; otherwise, false.

## boolInside ( WorldBoundSphere bs ) #

Checks if the bounding sphere specified in the argument is inside the current bounding sphere.

### Return value

true if the bounding sphere is inside the bounding sphere; otherwise, false.

## boolInside ( WorldBoundBox bb ) #

Checks if the bounding box specified in the argument is inside the current bounding sphere.

### Return value

true if the bounding box is inside the bounding sphere; otherwise, false.

## boolInsideValid ( WorldBoundSphere bs ) #

Checks if the bounding sphere specified in the argument is inside the current bounding sphere.
Notice
This method doesn't check if the current bounding sphere is valid (has a positive radius).

### Return value

true if the bounding sphere is inside the bounding sphere; otherwise, false.

## boolInsideValid ( WorldBoundBox bb ) #

Checks if the bounding box specified in the argument is inside the current bounding sphere.
Notice
This method doesn't check if the current bounding sphere is valid (has a positive radius).

### Return value

true if the bounding box is inside the bounding sphere; otherwise, false.

## boolInsideAll ( WorldBoundSphere bs ) #

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

### Return value

true if the whole bounding sphere is inside the bounding sphere; otherwise, false.

## boolInsideAll ( WorldBoundBox bb ) #

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

### Return value

true if the whole bounding box is inside the bounding sphere; otherwise, false.

## boolInsideAllValid ( WorldBoundSphere bs ) #

Checks if the whole bounding sphere specified in the argument is completely inside the current bounding sphere.
Notice
This method doesn't check if the current bounding sphere is valid (has a positive radius).

### Return value

true if the whole bounding sphere is inside the bounding sphere; otherwise, false.

## boolInsideAllValid ( WorldBoundBox bb ) #

Checks if the whole bounding box specified in the argument is completely inside the current bounding sphere.
Notice
This method doesn't check if the current bounding sphere is valid (has a positive radius).

### Return value

true if the whole bounding box is inside the bounding sphere; otherwise, false.

## boolRayIntersection ( dvec3 point, dvec3 direction ) #

Checks for an intersection between a ray and the current bound.

### Arguments

• dvec3 point - The starting point of the ray.
• dvec3 direction - Direction vector coordinates.

### Return value

true if an intersection has occurred; otherwise, false.

## boolGetIntersection ( dvec3 p0, dvec3 p1 ) #

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

### Arguments

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

### Return value

true if an intersection has occurred; otherwise, false.

## boolRayIntersectionValid ( dvec3 point, dvec3 direction ) #

Checks for an intersection between a ray and the current bound.
Notice
This method doesn't check if the current bounding sphere is valid (has a positive radius).

### Arguments

• dvec3 point - The starting point of the ray.
• dvec3 direction - Direction vector coordinates.

### Return value

true if an intersection has occurred; otherwise, false.

## boolGetIntersectionValid ( dvec3 p0, dvec3 p1 ) #

Checks for an intersection of a line with the current bounding sphere.
Notice
This method doesn't check if the current bounding sphere is valid (has a positive radius).

### Arguments

• dvec3 p0 - The starting point of the line.
• dvec3 p1 - The starting point of the line.

### Return value

true if an intersection has occurred; otherwise, false.

## doubleDistance ( ) #

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

### Return value

Distance from the origin, in units.

## doubleDistance ( dvec3 point ) #

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

### Arguments

• dvec3 point - Coordinates of the point.

### Return value

Distance from the point, in units.

## doubleDistanceValid ( ) #

Returns the distance from the origin of coordinates to the closest point of the current bounding sphere.
Notice
This method doesn't check if the current bounding sphere is valid (has a positive radius).

### Return value

Distance from the origin, in units.

## doubleDistanceValid ( dvec3 point ) #

Returns the distance from the given point to the closest point of the current bounding sphere.
Notice
This method doesn't check if the current bounding sphere is valid (has a positive radius).

### Arguments

• dvec3 point - Coordinates of the point.

### Return value

Distance from the origin, in units.

## boolIsCameraVisible ( dvec3 camera, double min_distance, double max_distance ) #

Checks if the bounding sphere is within the camera visibility distance.

### Arguments

• dvec3 camera - Camera position.
• double min_distance - Minimum visibility distance, in units.
• double max_distance - Maximum visibility distance, in units.

### Return value

true if the bounding sphere is within the camera visibility distance; otherwise, false.
Last update: 2022-12-14