This page has been translated automatically.
视频教程
界面
要领
高级
实用建议
基础
专业(SIM)
UnigineEditor
界面概述
资源工作流程
Version Control
设置和首选项
项目开发
调整节点参数
Setting Up Materials
设置属性
照明
Sandworm
使用编辑器工具执行特定任务
如何擴展編輯器功能
嵌入式节点类型
Nodes
Objects
Effects
Decals
光源
Geodetics
World Nodes
Sound Objects
Pathfinding Objects
Players
编程
基本原理
搭建开发环境
使用范例
C++
C#
UnigineScript
统一的Unigine着色器语言 UUSL (Unified UNIGINE Shader Language)
Plugins
File Formats
材质和着色器
Rebuilding the Engine Tools
GUI
双精度坐标
应用程序接口
Animations-Related Classes
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
VR-Related Classes
创建内容
内容优化
材质
Material Nodes Library
Miscellaneous
Input
Math
Matrix
Textures
Art Samples
Tutorials

Unigine::WorldBoundBox Struct

Header: #include <UnigineMathLibBounds.h>

This structure serves to construct the bounding box in double precision coordinates.

Bounding boxes has better precision quality but it takes more time for calculation in comparison with bounding spheres.

By using this structure you can easily find the common bounding box for several objects by expanding the bounding box.

WorldBoundBox Class

Members


static WorldBoundBoxPtr create ( ) #

Default constructor. Creates an empty bounding box.

WorldBoundBox ( const Math::Vec3 & min, const Math::Vec3 & max ) #

Constructor. Initializes new bounding box by minimum and maximum coordinates of the bounding box.

Arguments

  • const Math::Vec3 & min - The bounding box minimum coordinates.
  • const Math::Vec3 & max - The bounding box maximum coordinates.

BoundBox ( const Math::Vec3 * points, int num_points ) #

Constructor. Initialization by the vector of points.

Arguments

  • const Math::Vec3 * points - Vector of points.
  • int num_points - Number of points.

WorldBoundBox ( const WorldBoundBox & bb ) #

Constructor. Initializes new bounding box by using given bounding box.

Arguments

  • const WorldBoundBox & bb - Bounding box.

WorldBoundBox ( const WorldBoundBox & bb, const Math::Mat4 & transform ) #

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

Arguments

  • const WorldBoundBox & bb - Bounding box.
  • const Math::Mat4 & transform - Transformation matrix.

WorldBoundBox ( const BoundBox & bb ) #

Constructor. Initializes new bounding box by using given bounding box.

Arguments

WorldBoundBox ( const BoundBox & bb, const Math::Mat4 & transform ) #

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

Arguments

  • const BoundBox & bb - Bounding box.
  • const Math::Mat4 & transform - Transformation matrix.

WorldBoundBox ( const WorldBoundSphere & bs ) #

Constructor. Initializes new bounding box by the using given bounding sphere.

Arguments

WorldBoundBox & operator= ( const WorldBoundBox & bb ) #

Assignment operator for the bounding box.

Arguments

  • const WorldBoundBox & bb - Bounding box.

Return value

Bounding box.

void clear ( ) #

Clears the bounding box.

void set ( const Math::Vec3 & min, const Math::Vec3 & max ) #

Sets the bounding box by its minimum and maximum coordinates.

Arguments

  • const Math::Vec3 & min - Minimum coordinates of the bounding box.
  • const Math::Vec3 & max - Maximum coordinates of the bounding box.

void set ( const Math::Vec3 * points, int num_points ) #

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

Arguments

  • const Math::Vec3 * points - List of points to be enclosed by the bounding box.
  • int num_points - Number of points to be enclosed by the bounding box.

void set ( const WorldBoundSphere & bs ) #

Sets the bounding box by the bounding sphere.

Arguments

void set ( const WorldBoundBox & bb ) #

Sets the bounding box.

Arguments

  • const WorldBoundBox & bb - The bounding box.

void set ( const WorldBoundBox & bb, const Math::Mat4 & transform ) #

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

Arguments

  • const WorldBoundBox & bb - The bounding box.
  • const Math::Mat4 & transform - Transformation matrix.

void set ( const BoundBox & bb ) #

Sets the bounding box.

Arguments

void set ( const BoundBox & bb, const Math::Mat4 & transform ) #

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

Arguments

  • const BoundBox & bb - Source bounding box.
  • const Math::Mat4 & transform - Transformation matrix.

bool isValid ( ) const#

Checks if the bounding box coordinates are valid (minimum coordinate along the X axis is less or equal to the maximum coordinate along the X axis).

Return value

true if the bounding box minimum and maximum coordinates are valid, otherwise, false.

Math::Vec3 getCenter ( ) const#

Returns the center point of the current bounding box.

Return value

Center point.

Math::Vec3 getSize ( ) const#

Returns the size of the bounding box along the axes.

Return value

Vector containing sizes of the bounding box along the axes, in units.

void getPoints ( Math::Vec3 * points, int num_points ) const#

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

Arguments

  • Math::Vec3 * points - Target vector.
  • int num_points - Number of points, must be equal to 8.

void getPlanes ( Math::Vec4 * planes, int num_planes ) const#

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

Arguments

  • Math::Vec4 * planes - Target vector.
  • int num_planes - Number of planes, must be equal to 6.

void setTransform ( const Math::Mat4 & transform ) #

Sets the given transformation matrix to the bounding box.

Arguments

  • const Math::Mat4 & transform - Transformation matrix.

void setTransform ( const WorldBoundSphere & bs, const Math::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

int compare ( const WorldBoundBox & bb ) const#

Compares the current bounding box with the given one.

Arguments

  • const WorldBoundBox & bb - The bounding box to compare with.

Return value

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

int operator== ( const WorldBoundBox& bb ) const#

Compares the current bounding box with the given one.

Arguments

  • const WorldBoundBox& bb - The bounding box to compare with.

Return value

true if the size and position of both bounding boxes are equal; otherwise, false.

int operator!= ( const WorldBoundBox & bb ) const#

Bounding boxes not equal comparison operator.

Arguments

  • const WorldBoundBox & bb - The bounding box to compare with.

Return value

true if the size and position of both bounding boxes are not equal; otherwise, false.

void expand ( const Math::Vec3 & point ) #

Expands the current bounding box to include the given point.

Arguments

  • const Math::Vec3 & point - Coordinates of the point.

void expand ( const Math::Vec3 * points, int num_points ) #

Expands the current bounding box to enclose all given points.

Arguments

  • const Math::Vec3 * points - List of points to be enclosed by the bounding box.
  • int num_points - Number of points to be enclosed by the bounding box.

void expand ( const WorldBoundSphere & bs ) #

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

Arguments

void expand ( const WorldBoundBox & bb ) #

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

Arguments

  • const WorldBoundBox & bb - The bounding box.

int inside ( const Math::Vec3 & point ) const#

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

Arguments

  • const Math::Vec3 & point - Coordinates of the point.

Return value

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

int inside ( const Math::Vec3 & point, Math::Scalar radius ) const#

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

Arguments

  • const Math::Vec3 & point - The coordinates of the center of the sphere.
  • Math::Scalar radius - The sphere radius.

Return value

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

int inside ( const Math::Vec3 & min, const Math::Vec3 & max ) const#

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

Arguments

  • const Math::Vec3 & min - Minimum coordinates of the box.
  • const Math::Vec3 & max - Maximum coordinates of the box.

Return value

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

int inside ( const WorldBoundSphere & bs ) const#

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 ( const WorldBoundBox & bb ) const#

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

Arguments

  • const WorldBoundBox & bb - The bounding box.

Return value

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

int insideValid ( const Math::Vec3 & point ) const#

Checks if the given point is inside the current bounding box.
Notice
The method doesn't check if the bounding box is valid (has a positive radius).

Arguments

  • const Math::Vec3 & point - Point.

Return value

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

int insideValid ( const Math::Vec3 & point, Math::Scalar radius ) const#

Checks if the given sphere is inside the current bounding box.
Notice
The method doesn't check if the bounding box is valid (has a positive radius).

Arguments

  • const Math::Vec3 & point - Cente of the sphere.
  • Math::Scalar radius - Radius of the sphere.

Return value

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

int insideValid ( const Math::Vec3 & min, const Math::Vec3 & max ) const#

Checks if the box is inside the bounding box.
Notice
The method doesn't check if the bounding box is valid (has a positive radius).

Arguments

  • const Math::Vec3 & min - The box minimum coordinates.
  • const Math::Vec3 & max - The box maximum coordinates.

Return value

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

bool insideValid ( const Math::Vec3 * points, int num_points ) const#

Checks if any of the given points is inside the bounding box.
Notice
The method doesn't check if the minimum and maximum coordinates of the current bounding box are valid.

Arguments

  • const Math::Vec3 * points - Array of points to be checked.
  • int num_points - Number of points to be checked.

Return value

true if any of the given points is inside the bounding box; otherwise, false.

int insideValid ( const WorldBoundSphere & bs ) const#

Checks if the bounding sphere is inside the bounding box.
Notice
The method doesn't check if the bounding box is valid (has a positive radius).

Arguments

Return value

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

int insideValid ( const WorldBoundBox & bb ) const#

Checks if the given bounding box is inside the current bounding box.
Notice
The method doesn't check if the bounding box is valid (has a positive radius).

Arguments

  • const WorldBoundBox & bb - The bounding box.

Return value

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

int insideAll ( const WorldBoundSphere & bs ) const#

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

Arguments

Return value

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

int insideAll ( const WorldBoundBox & bb ) const#

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

Arguments

  • const WorldBoundBox & bb - The bounding box.

Return value

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

int insideAllValid ( const WorldBoundSphere & bs ) const#

Checks if the whole given bounding sphere is inside the current bounding box.
Notice
The method doesn't check if the bounding box is valid (has a positive radius).

Arguments

Return value

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

int insideAllValid ( const WorldBoundBox & bb ) const#

Checks if the whole given bounding box is inside the current bounding box.
Notice
The method doesn't check if the bounding box is valid (has a positive radius).

Arguments

  • const WorldBoundBox & bb - Bounding box.

Return value

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

bool insideAllValid ( const Math::Vec3* points, int num_points ) const#

Checks if all specified points are inside the current bounding box.
Notice
The method doesn't check if the minimum and maximum coordinates of the current bounding box are valid.

Arguments

  • const Math::Vec3* points - Array of points to be checked.
  • int num_points - Number of points to be checked.

Return value

true if the all specified points are inside the bounding box; otherwise, false.

int insideCube ( int face, const Math::Vec3 & offset ) const#

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.
  • const Math::Vec3 & offset - Offset.

Return value

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

int rayIntersection ( const Math::Vec3 & p, const Math::Vec3 & direction ) const#

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

Arguments

  • const Math::Vec3 & p - Starting point of the ray.
  • const Math::Vec3 & direction - Direction vector of the ray.

Return value

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

int irayIntersection ( const Math::Vec3 & p, const Math::Vec3 & idirection ) const#

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

  • const Math::Vec3 & p - Starting point of the ray.
  • const Math::Vec3 & idirection - Inverse direction of the ray.

Return value

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

int getIntersection ( const Math::Vec3 & p0, const Math::vec3 & p1 ) const#

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

Arguments

  • const Math::Vec3 & p0 - Starting point of the line.
  • const Math::vec3 & p1 - Ending point of the line.

Return value

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

int rayIntersectionValid ( const Math::Vec3 & point, const Math::Vec3 & direction ) const#

Checks for an intersection between a ray and the current bounding box.
Notice
This function doesn't check if the minimum and maximum coordinates of the bounding box are valid.

Arguments

  • const Math::Vec3 & point - Starting point of the ray.
  • const Math::Vec3 & direction - Direction vector of the ray.

Return value

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

int irayIntersectionValid ( const Math::Vec3 & p, const Math::Vec3 & idirection ) const#

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

  • const Math::Vec3 & p - Starting point of the ray.
  • const Math::Vec3 & idirection - Inverse direction of the ray.

Return value

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

int getIntersectionValid ( const Math::Vec3 & p0, const Math::vec3 & p1 ) const#

Checks for an intersection between a line and the current bounding box.
Notice
This function doesn't check if the minimum and maximum coordinates of the bounding box are valid.

Arguments

  • const Math::Vec3 & p0 - Starting point of the line.
  • const Math::vec3 & p1 - Enging point of the line.

Return value

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

double distance ( ) const#

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.

double distance ( const Math::Vec3 & point ) const#

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

Arguments

  • const Math::Vec3 & point - Coordinates of a point.

Return value

Distance, in units.

double distanceValid ( ) const#

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

Return value

Distance from the given point to the closest vertex of the bounding box, in units.

double distanceValid ( const Math::Vec3 & point ) const#

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

Arguments

  • const Math::Vec3 & point - Coordinates of the point.

Return value

Distance from the given point to the closest vertex of the bounding box, in units.

WorldBoundBox operator* ( const dmat4 & m, const WorldBoundBox & bs ) #

Returns the bounding box with the specified transformation matrix applied.

Arguments

  • const dmat4 & m - Transform matrix.
  • const WorldBoundBox & bs - The bounding sphere.

Return value

The bounding sphere with the specified transform.
Last update: 2024-10-30
Build: ()