This page has been translated automatically.
UnigineEditor
Interface Overview
Assets Workflow
Settings and Preferences
Working With Projects
Adjusting Node Parameters
Setting Up Materials
Setting Up Properties
Landscape Tool
Using Editor Tools for Specific Tasks
Extending Editor Functionality
编程
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
应用程序接口
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
注意! 这个版本的文档是过时的,因为它描述了一个较老的SDK版本!请切换到最新SDK版本的文档。
注意! 这个版本的文档描述了一个不再受支持的旧SDK版本!请升级到最新的SDK版本。

Unigine::WorldBoundBox Class

Header: #include <UnigineBounds.h>

This class 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 class 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.

WorldBoundBox ( const WorldBoundBox & bb ) #

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

Arguments

  • const WorldBoundBox & bb - Bounding box.

WorldBoundBox ( const WorldBoundSphere & bs ) #

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

Arguments

  • const WorldBoundSphere & bs - Bounding sphere.

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

Arguments

  • const BoundBox & bb
  • const Math::Mat4 & transform

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 ( ) #

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

Arguments

    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 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.

    void set ( const WorldBoundSphere & bs ) #

    Sets the bounding box by the bounding sphere.

    Arguments

    • const WorldBoundSphere & bs - The bounding sphere.

    void set ( const WorldBoundBox & bb ) #

    Sets the bounding box.

    Arguments

    • const WorldBoundBox & bb - The bounding box.

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

    Sets the given transformation matrix to the bounding box.

    Arguments

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

    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.

    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

    • const WorldBoundSphere & bs - The bounding sphere.

    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

    • const WorldBoundSphere & bs - The bounding sphere.

    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.

    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

    • const WorldBoundSphere & bs - The bounding sphere.

    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

    • const WorldBoundSphere & bs - The bounding sphere.

    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

    • const WorldBoundSphere & bs - Bounding sphere.

    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.

    int insideCube ( int face, const Math::Vec3 & point ) 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 & point - 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 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.

    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 getMin ( ) const#

    Returns the minimum coordinates of the bounding box.

    Return value

    Bounding box minimum coordinates.

    Math::Vec3 getMax ( ) const#

    Returns the maximum coordinates of the bounding box.

    Return value

    Bounding box maximum coordinates.

    Math::Vec3 getCenter ( ) const#

    Returns the center point of the current bounding box.

    Return value

    Center point.
    Last update: 2020-07-31
    Build: ()