cesium-native 0.45.0
Loading...
Searching...
No Matches
CesiumGeometry::BoundingCylinderRegion Class Referencefinal

A bounding volume defined as a region following the surface of a cylinder between two radius values. Used for creating bounding volumes from 3DTILES_bounding_volume_cylinder. More...

#include <CesiumGeometry/BoundingCylinderRegion.h>

Public Member Functions

 BoundingCylinderRegion (const glm::dvec3 &translation, const glm::dquat &rotation, double height, const glm::dvec2 &radialBounds, const glm::dvec2 &angularBounds={ -CesiumUtility::Math::OnePi, CesiumUtility::Math::OnePi}) noexcept
 Construct a new bounding cylinder region.
 
constexpr const glm::dvec3 & getCenter () const noexcept
 Gets the center of the cylinder region.
 
constexpr const glm::dvec3 & getTranslation () const noexcept
 Gets the translation that is applied to the bounding cylinder region.
 
constexpr const glm::dquat & getRotation () const noexcept
 Gets the rotation that is applied to the bounding cylinder region.
 
constexpr double getHeight () const noexcept
 Gets the height of the cylinder region.
 
constexpr const glm::dvec2 & getRadialBounds () const noexcept
 Gets the radial bounds of the cylinder region.
 
constexpr const glm::dvec2 & getAngularBounds () const noexcept
 Gets the angular bounds of the cylinder region.
 
CullingResult intersectPlane (const Plane &plane) const noexcept
 Determines on which side of a plane the bounding cylinder is located.
 
double computeDistanceSquaredToPosition (const glm::dvec3 &position) const noexcept
 Computes the distance squared from a given position to the closest point on the bounding volume. The bounding volume and the position must be expressed in the same coordinate system.
 
bool contains (const glm::dvec3 &position) const noexcept
 Computes whether the given position is contained within the bounding cylinder.
 
BoundingCylinderRegion transform (const glm::dmat4 &transformation) const noexcept
 Transforms this bounding cylinder region to another coordinate system using a 4x4 matrix.
 
OrientedBoundingBox toOrientedBoundingBox () const noexcept
 Converts this bounding cylinder region to an oriented bounding box.
 

Detailed Description

A bounding volume defined as a region following the surface of a cylinder between two radius values. Used for creating bounding volumes from 3DTILES_bounding_volume_cylinder.

Note: This uses a OrientedBoundingBox underneath the hood to approximate the result, similar to how CesiumJS approximates cylinders. The output may not be accurate to the actual cylinder itself.

See also
OrientedBoundingBox

Definition at line 27 of file BoundingCylinderRegion.h.

Constructor & Destructor Documentation

◆ BoundingCylinderRegion()

CesiumGeometry::BoundingCylinderRegion::BoundingCylinderRegion ( const glm::dvec3 & translation,
const glm::dquat & rotation,
double height,
const glm::dvec2 & radialBounds,
const glm::dvec2 & angularBounds = { -CesiumUtility::Math::OnePiCesiumUtility::Math::OnePi} )
noexcept

Construct a new bounding cylinder region.

Remarks
A cylinder region is defined relative to a reference cylinder centered at the local origin. The height aligns with the z-axis, and the cylinder extends to half the height in each direction. The angular bounds are in the range [-pi, pi], and are oriented such that an angle of -pi aligns with the negative x-axis, while an angle of 0 aligns with the positive x-axis. The angular range opens counter-clockwise.

It is possible for the region to only occupy part of the cylinder, and if that is the case, the region's center may not necessarily equal the translation. Additionally, the rotation is applied at to the reference cylinder at the local origin. In other words, the region is rotated around the whole cylinder's center, and not necessarily its own.

Parameters
translationThe translation applied to the reference cylinder.
rotationThe rotation applied to the reference cylinder.
heightThe height of the cylinder region along the z-axis.
radialBoundsThe radial bounds of the region, where x is the minimum radius and y is the maximum.
angularBoundsThe angular bounds of the region, where x is the minimum angle and y is the maximum.
// Create an Bounding Cylinder Region using a translation, rotation,
// height, and both radial and angular bounds.
glm::dvec3 translation(1.0, 2.0, 3.0);
glm::dquat rotation(1.0, 0.0, 0.0, 0.0);
double height = 2.0;
glm::dvec2 radialBounds(0.5, 1.0);
glm::dvec2 angularBounds(-Math::PiOverTwo, 0.0);
auto cylinder = BoundingCylinderRegion(
translation,
rotation,
height,
radialBounds,
angularBounds);

Member Function Documentation

◆ computeDistanceSquaredToPosition()

double CesiumGeometry::BoundingCylinderRegion::computeDistanceSquaredToPosition ( const glm::dvec3 & position) const
noexcept

Computes the distance squared from a given position to the closest point on the bounding volume. The bounding volume and the position must be expressed in the same coordinate system.

Parameters
positionThe position
Returns
The estimated distance squared from the bounding cylinder to the point.

◆ contains()

bool CesiumGeometry::BoundingCylinderRegion::contains ( const glm::dvec3 & position) const
noexcept

Computes whether the given position is contained within the bounding cylinder.

Parameters
positionThe position.
Returns
Whether the position is contained within the bounding cylinder.

◆ getAngularBounds()

const glm::dvec2 & CesiumGeometry::BoundingCylinderRegion::getAngularBounds ( ) const
inlineconstexprnoexcept

Gets the angular bounds of the cylinder region.

Definition at line 102 of file BoundingCylinderRegion.h.

◆ getCenter()

const glm::dvec3 & CesiumGeometry::BoundingCylinderRegion::getCenter ( ) const
inlineconstexprnoexcept

Gets the center of the cylinder region.

Definition at line 67 of file BoundingCylinderRegion.h.

◆ getHeight()

double CesiumGeometry::BoundingCylinderRegion::getHeight ( ) const
inlineconstexprnoexcept

Gets the height of the cylinder region.

Definition at line 90 of file BoundingCylinderRegion.h.

◆ getRadialBounds()

const glm::dvec2 & CesiumGeometry::BoundingCylinderRegion::getRadialBounds ( ) const
inlineconstexprnoexcept

Gets the radial bounds of the cylinder region.

Definition at line 95 of file BoundingCylinderRegion.h.

◆ getRotation()

const glm::dquat & CesiumGeometry::BoundingCylinderRegion::getRotation ( ) const
inlineconstexprnoexcept

Gets the rotation that is applied to the bounding cylinder region.

Definition at line 83 of file BoundingCylinderRegion.h.

◆ getTranslation()

const glm::dvec3 & CesiumGeometry::BoundingCylinderRegion::getTranslation ( ) const
inlineconstexprnoexcept

Gets the translation that is applied to the bounding cylinder region.

Definition at line 75 of file BoundingCylinderRegion.h.

◆ intersectPlane()

CullingResult CesiumGeometry::BoundingCylinderRegion::intersectPlane ( const Plane & plane) const
noexcept

Determines on which side of a plane the bounding cylinder is located.

Parameters
planeThe plane to test against.
Returns
The CullingResult:
  • Inside if the entire cylinder is on the side of the plane the normal is pointing.
  • Outside if the entire cylinder is on the opposite side.
  • Intersecting if the cylinder intersects the plane.

◆ transform()

BoundingCylinderRegion CesiumGeometry::BoundingCylinderRegion::transform ( const glm::dmat4 & transformation) const
noexcept

Transforms this bounding cylinder region to another coordinate system using a 4x4 matrix.

Parameters
transformationThe transformation.
Returns
The bounding cylinder region in the new coordinate system.

The documentation for this class was generated from the following file: