cesium-native 0.43.0
Loading...
Searching...
No Matches
CesiumGeospatial::S2CellBoundingVolume Class Referencefinal

#include <CesiumGeospatial/S2CellBoundingVolume.h>

Public Member Functions

 S2CellBoundingVolume (const S2CellID &cellID, double minimumHeight, double maximumHeight, const CesiumGeospatial::Ellipsoid &ellipsoid=CesiumGeospatial::Ellipsoid::WGS84)
 Creates a new S2CellBoundingVolume.
 
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.
 
std::span< const glm::dvec3 > getVertices () const noexcept
 Gets the either corners of the bounding volume, in ellipsoid-fixed (ECEF) coordinates.
 
CesiumGeometry::CullingResult intersectPlane (const CesiumGeometry::Plane &plane) const noexcept
 Determines on which side of a plane the bounding volume is located.
 
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.
 
std::span< const CesiumGeometry::PlanegetBoundingPlanes () const noexcept
 Gets the six planes that bound the volume.
 
BoundingRegion computeBoundingRegion (const CesiumGeospatial::Ellipsoid &ellipsoid=CesiumGeospatial::Ellipsoid::WGS84) const noexcept
 Computes the bounding begion that best fits this S2 cell volume.
 

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.

Definition at line 23 of file S2CellBoundingVolume.h.

Constructor & Destructor Documentation

◆ S2CellBoundingVolume()

CesiumGeospatial::S2CellBoundingVolume::S2CellBoundingVolume ( const S2CellID & cellID,
double minimumHeight,
double maximumHeight,
const CesiumGeospatial::Ellipsoid & ellipsoid = CesiumGeospatial::Ellipsoid::WGS84 )

Creates a new S2CellBoundingVolume.

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

Member Function Documentation

◆ computeBoundingRegion()

BoundingRegion CesiumGeospatial::S2CellBoundingVolume::computeBoundingRegion ( const CesiumGeospatial::Ellipsoid & ellipsoid = CesiumGeospatial::Ellipsoid::WGS84) 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()

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

◆ getCellID()

const S2CellID & CesiumGeospatial::S2CellBoundingVolume::getCellID ( ) const
inline

Gets this bounding volume's cell ID.

Definition at line 41 of file S2CellBoundingVolume.h.

◆ getMaximumHeight()

double CesiumGeospatial::S2CellBoundingVolume::getMaximumHeight ( ) const
inlinenoexcept

Gets the maximum height of the cell.

Definition at line 51 of file S2CellBoundingVolume.h.

◆ getMinimumHeight()

double CesiumGeospatial::S2CellBoundingVolume::getMinimumHeight ( ) const
inlinenoexcept

Gets the minimum height of the cell.

Definition at line 46 of file S2CellBoundingVolume.h.

◆ getVertices()

std::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: