cesium-native  0.41.0
S2CellBoundingVolume.h
1 #pragma once
2 
3 #include "BoundingRegion.h"
4 #include "Ellipsoid.h"
5 #include "S2CellID.h"
6 
7 #include <CesiumGeometry/CullingResult.h>
8 #include <CesiumGeometry/Plane.h>
9 
10 #include <glm/vec3.hpp>
11 #include <gsl/span>
12 
13 #include <array>
14 #include <string_view>
15 
16 namespace CesiumGeospatial {
17 
28 class CESIUMGEOSPATIAL_API S2CellBoundingVolume final {
29 public:
31  const S2CellID& cellID,
32  double minimumHeight,
33  double maximumHeight,
34  const CesiumGeospatial::Ellipsoid& ellipsoid CESIUM_DEFAULT_ELLIPSOID);
35 
39  const S2CellID& getCellID() const { return this->_cellID; }
40 
44  double getMinimumHeight() const noexcept { return this->_minimumHeight; }
45 
49  double getMaximumHeight() const noexcept { return this->_maximumHeight; }
50 
55  glm::dvec3 getCenter() const noexcept;
56 
63  gsl::span<const glm::dvec3> getVertices() const noexcept;
64 
75  CesiumGeometry::CullingResult
76  intersectPlane(const CesiumGeometry::Plane& plane) const noexcept;
77 
88  double
89  computeDistanceSquaredToPosition(const glm::dvec3& position) const noexcept;
90 
96  gsl::span<const CesiumGeometry::Plane> getBoundingPlanes() const noexcept;
97 
104  computeBoundingRegion(const CesiumGeospatial::Ellipsoid& ellipsoid
105  CESIUM_DEFAULT_ELLIPSOID) const noexcept;
106 
107 private:
108  S2CellID _cellID;
109  double _minimumHeight;
110  double _maximumHeight;
111  glm::dvec3 _center;
112  std::array<CesiumGeometry::Plane, 6> _boundingPlanes;
113  std::array<glm::dvec3, 8> _vertices;
114 };
115 
116 } // namespace CesiumGeospatial
A bounding volume specified as a longitude/latitude bounding box and a minimum and maximum height.
A quadratic surface defined in Cartesian coordinates.
Definition: Ellipsoid.h:38
glm::dvec3 getCenter() const noexcept
Gets the center of this bounding volume in ellipsoid-fixed (ECEF) coordinates.
double getMaximumHeight() const noexcept
Gets the maximum height of the cell.
const S2CellID & getCellID() const
Gets this bounding volume's cell ID.
double getMinimumHeight() const noexcept
Gets the minimum height of the cell.
A 64-bit unsigned integer that uniquely identifies a cell in the S2 cell decomposition.
Definition: S2CellID.h:47
Basic geometry classes for Cesium.
Classes for geospatial computations in Cesium.