This page has been translated automatically.
Video Tutorials
Interface
Essentials
Advanced
How To
UnigineEditor
Interface Overview
Assets Workflow
Settings and Preferences
Working With Projects
Adjusting Node Parameters
Setting Up Materials
Setting Up Properties
Lighting
Landscape Tool
Sandworm
Using Editor Tools for Specific Tasks
Extending Editor Functionality
Built-in Node Types
Nodes
Objects
Effects
Decals
Light Sources
Geodetics
World Objects
Sound Objects
Pathfinding Objects
Players
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
Content Creation
Content Optimization
Materials
Art Samples
Tutorials
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.BoundBox Class

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

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

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

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

BoundBox Class

Properties

vec3 Center#

The center point of the current bounding box.

vec3 Max#

The maximum coordinates of the bounding box.

vec3 Min#

The minimum coordinates of the bounding box.

bool IsValid#

The bounding box status.

Members


BoundBox ( ) #

Constructor. Creates an empty bounding box.

BoundBox ( BoundBox bb ) #

Initialization by the bounding box.

Arguments

  • BoundBox bb - Bounding box.

BoundBox ( BoundSphere bs ) #

Initialization by the bounding sphere.

Arguments

BoundBox ( BoundBox bb, mat4 transform ) #

Initialization by the bounding box with the transformation matrix taken into account.

Arguments

  • BoundBox bb - Bounding box.
  • mat4 transform - Transformation matrix.

BoundBox ( vec3[] points ) #

Initialization by the array of points.

Arguments

  • vec3[] points - Array of points.

BoundBox ( vec3 min, vec3 max ) #

Initialization by minimum and maximum coordinates of the bounding box.

Arguments

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

void Clear ( ) #

Clears the bounding box.

void Set ( vec3 min, vec3 max ) #

Sets the bounding box by its minimum and maximum coordinates.

Arguments

  • vec3 min - Minimum coordinates of the bounding box.
  • vec3 max - Maximum coordinates of the bounding box.

void Set ( vec3[] points ) #

Sets the bounding box by the coordinates of points in space to be enclosed by it.

Arguments

  • vec3[] points - Array of points to be enclosed by the bounding box.

void Set ( BoundSphere bs ) #

Sets the bounding box by the bounding sphere.

Arguments

void Set ( BoundBox bb ) #

Sets the bounding box equal to the specified source bounding box.

Arguments

  • BoundBox bb - Source bounding box.

void Set ( BoundBox bb, mat4 transform ) #

Sets the bounding box by the given bounding box with the given transformation matrix taken into account.

Arguments

  • BoundBox bb - Bounding box.
  • mat4 transform - Transformation matrix.

void SetTransform ( mat4 transform ) #

Sets the given transformation matrix to the bounding box.

Arguments

  • mat4 transform - Transformation matrix.

void SetTransform ( dmat4 transform ) #

Sets the given transformation matrix to the bounding box.

Arguments

  • dmat4 transform - Transformation matrix.

void SetTransform ( BoundSphere bs, mat4 transform ) #

Sets the transformation matrix of the current bounding box for including the given bounding sphere with the given transformation matrix taken into account.

Arguments

void SetTransform ( BoundSphere bs, dmat4 transform ) #

Sets the transformation matrix of the current bounding box for including the given bounding sphere with the given transformation matrix taken into account.

Arguments

int Compare ( BoundBox bb ) #

Compares the current bounding box with the given one.

Arguments

  • BoundBox bb - The bounding box to compare with.

Return value

1 if the size and position of both bounding boxes are equal; otherwise, 0.

void Expand ( vec3 point ) #

Expands the current bounding box to enclose the given point.

Arguments

  • vec3 point - Point coordinates.

void Expand ( vec3[] points ) #

Expands the current bounding box to enclose all given points.

Arguments

  • vec3[] points - Array of points to be enclosed by the bounding box.

void Expand ( BoundSphere bs ) #

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

Arguments

void Expand ( BoundBox bb ) #

Expands the current bounding box to enclose the given bounding box.

Arguments

  • BoundBox bb - Bounding box.

int Inside ( vec3 point ) #

Checks if the given point is inside the bounding box.

Arguments

Return value

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

int Inside ( vec3 point, float radius ) #

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

Arguments

  • vec3 point - Coordinates of the center of the sphere.
  • float radius - Sphere radius.

Return value

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

int Inside ( vec3 min, vec3 max ) #

Checks if the box with the given coordinates is inside the current bounding box.

Arguments

  • vec3 min - Minimum coordinates of the box.
  • vec3 max - Maximum coordinates of the box.

Return value

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

int Inside ( BoundSphere bs ) #

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

Arguments

Return value

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

int Inside ( BoundBox bb ) #

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

Arguments

  • BoundBox bb - Bounding box.

Return value

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

int InsideAll ( BoundSphere bs ) #

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

Arguments

Return value

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

int InsideAll ( BoundBox bb ) #

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

Arguments

  • BoundBox bb - Bounding box.

Return value

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

int InsideCube ( int face, vec3 offset ) #

Checks if a face of the current bounding box is inside the cube represented by minimum and maximum coordinates of the bounding box.

Arguments

  • int face - The face index from 0 to 5.
  • vec3 offset - Offset.

Return value

1 if the face is inside the bounding cube; otherwise, 0.

int RayIntersection ( vec3 point, vec3 direction ) #

Checks for an intersection between a ray and the current bounding box.

Arguments

  • vec3 point - Starting point of the ray.
  • vec3 direction - Direction vector of the ray.

Return value

1 if the given ray intersects the bounding box; otherwise, 0.

int IrayIntersection ( vec3 point, vec3 idirection ) #

Checks for an intersection between a ray and the current bounding box. This function uses the inverse direction of the ray, which increases performance.

Arguments

  • vec3 point - Starting point of the ray.
  • vec3 idirection - Inverse direction of the ray.

Return value

1 if the given ray intersects the bounding box; otherwise, 0.

int GetIntersection ( vec3 p0, vec3 p1 ) #

Checks for an intersection between a line and the current bounding box.

Arguments

  • vec3 p0 - Starting point of the line.
  • vec3 p1 - Enging point of the line.

Return value

1 if the given line intersects the bounding box; otherwise, 0.

float Distance ( ) #

Returns the distance from the origin of coordinates to the closest vertex of the bounding box.

Return value

Distance in units if the minimum and maximum coordinates of the bounding box are valid; otherwise, INF.

float Distance ( vec3 point ) #

Returns the distance from the given point to the closest vertex of the bounding box.

Arguments

  • vec3 point - Coordinates of a point.

Return value

Distance, in units.

void Points ( vec3[] points, int num_points ) #

Puts the vertices of the current bounding box into the given array.

Arguments

  • vec3[] points - Target array.
  • int num_points - Number of points, must be equal to 8.

void Planes ( vec4[] planes, int num_planes ) #

Puts the planes created based on the vertices of the current bounding box into the given array.

Arguments

  • vec4[] planes - Target array.
  • int num_planes - Number of planes, must be equal to 6.
Last update: 2021-04-29
Build: ()