cesium-native 0.43.0
Loading...
Searching...
No Matches
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
12#include <array>
13#include <span>
14#include <string_view>
15
16namespace CesiumGeospatial {
17
23class CESIUMGEOSPATIAL_API S2CellBoundingVolume final {
24public:
33 const S2CellID& cellID,
34 double minimumHeight,
35 double maximumHeight,
36 const CesiumGeospatial::Ellipsoid& ellipsoid CESIUM_DEFAULT_ELLIPSOID);
37
41 const S2CellID& getCellID() const { return this->_cellID; }
42
46 double getMinimumHeight() const noexcept { return this->_minimumHeight; }
47
51 double getMaximumHeight() const noexcept { return this->_maximumHeight; }
52
57 glm::dvec3 getCenter() const noexcept;
58
65 std::span<const glm::dvec3> getVertices() const noexcept;
66
77 CesiumGeometry::CullingResult
78 intersectPlane(const CesiumGeometry::Plane& plane) const noexcept;
79
90 double
91 computeDistanceSquaredToPosition(const glm::dvec3& position) const noexcept;
92
98 std::span<const CesiumGeometry::Plane> getBoundingPlanes() const noexcept;
99
106 computeBoundingRegion(const CesiumGeospatial::Ellipsoid& ellipsoid
107 CESIUM_DEFAULT_ELLIPSOID) const noexcept;
108
109private:
110 S2CellID _cellID;
111 double _minimumHeight;
112 double _maximumHeight;
113 glm::dvec3 _center;
114 std::array<CesiumGeometry::Plane, 6> _boundingPlanes;
115 std::array<glm::dvec3, 8> _vertices;
116};
117
118} // 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.
const S2CellID & getCellID() const
Gets this bounding volume's cell ID.
double getMaximumHeight() const noexcept
Gets the maximum height of the cell.
S2CellBoundingVolume(const S2CellID &cellID, double minimumHeight, double maximumHeight, const CesiumGeospatial::Ellipsoid &ellipsoid=CesiumGeospatial::Ellipsoid::WGS84)
Creates a new S2CellBoundingVolume.
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.
STL namespace.