cesium-native  0.41.0
CesiumGeospatial::S2CellBoundingVolume Class Referencefinal

#include <CesiumGeospatial/S2CellBoundingVolume.h>

Public Member Functions

 S2CellBoundingVolume (const S2CellID &cellID, double minimumHeight, double maximumHeight, const CesiumGeospatial::Ellipsoid &ellipsoid CESIUM_DEFAULT_ELLIPSOID)
 
const S2CellIDgetCellID () const
 Gets this bounding volume's cell ID.
 
double getMinimumHeight () const noexcept
 Gets the minimum height of the cell.
 
double getMaximumHeight () const noexcept
 Gets the maximum height of the cell.
 
glm::dvec3 getCenter () const noexcept
 Gets the center of this bounding volume in ellipsoid-fixed (ECEF) coordinates.
 
gsl::span< const glm::dvec3 > getVertices () const noexcept
 Gets the either corners of the bounding volume, in ellipsoid-fixed (ECEF) coordinates. More...
 
CesiumGeometry::CullingResult intersectPlane (const CesiumGeometry::Plane &plane) const noexcept
 Determines on which side of a plane the bounding volume is located. More...
 
double computeDistanceSquaredToPosition (const glm::dvec3 &position) const noexcept
 Computes the distance squared from a given position to the closest point on this bounding volume. The position must be expressed in ellipsoid-centered (ECEF) coordinates. More...
 
gsl::span< const CesiumGeometry::PlanegetBoundingPlanes () const noexcept
 Gets the six planes that bound the volume. More...
 
BoundingRegion computeBoundingRegion (const CesiumGeospatial::Ellipsoid &ellipsoid CESIUM_DEFAULT_ELLIPSOID) const noexcept
 Computes the bounding begion that best fits this S2 cell volume. More...
 

Detailed Description

A tile bounding volume specified as an S2 cell token with minimum and maximum heights. The bounding volume is a k DOP. A k-DOP is the Boolean intersection of extents along k directions.

Parameters
cellIDThe S2 cell ID.
minimumHeightThe minimum height of the bounding volume.
maximumHeightThe maximum height of the bounding volume.
ellipsoidThe ellipsoid.

Definition at line 28 of file S2CellBoundingVolume.h.

Member Function Documentation

◆ computeBoundingRegion()

BoundingRegion CesiumGeospatial::S2CellBoundingVolume::computeBoundingRegion ( const CesiumGeospatial::Ellipsoid &ellipsoid  CESIUM_DEFAULT_ELLIPSOID) const
noexcept

Computes the bounding begion that best fits this S2 cell volume.

Returns
The bounding region.

◆ computeDistanceSquaredToPosition()

double CesiumGeospatial::S2CellBoundingVolume::computeDistanceSquaredToPosition ( const glm::dvec3 &  position) const
noexcept

Computes the distance squared from a given position to the closest point on this bounding volume. The position must be expressed in ellipsoid-centered (ECEF) coordinates.

Parameters
positionThe position
Returns
The estimated distance squared from the bounding box to the point.
// Sort bounding boxes from back to front
glm::dvec3 cameraPosition = anyOldCameraPosition();
std::vector<OrientedBoundingBox> boxes = anyOldBoxArray();
std::sort(boxes.begin(), boxes.end(), [&cameraPosition](auto& a, auto& b) {
return a.computeDistanceSquaredToPosition(cameraPosition) >
b.computeDistanceSquaredToPosition(cameraPosition);
});

◆ getBoundingPlanes()

gsl::span<const CesiumGeometry::Plane> CesiumGeospatial::S2CellBoundingVolume::getBoundingPlanes ( ) const
noexcept

Gets the six planes that bound the volume.

Returns
An array of planes with a size() of 6.

◆ getVertices()

gsl::span<const glm::dvec3> CesiumGeospatial::S2CellBoundingVolume::getVertices ( ) const
noexcept

Gets the either corners of the bounding volume, in ellipsoid-fixed (ECEF) coordinates.

Returns
An array of positions with a size() of 8.

◆ intersectPlane()

CesiumGeometry::CullingResult CesiumGeospatial::S2CellBoundingVolume::intersectPlane ( const CesiumGeometry::Plane plane) const
noexcept

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

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

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