cesium-native 0.46.0
Loading...
Searching...
No Matches
BoundingCylinderRegion.h
1#pragma once
2
3#include <CesiumGeometry/Library.h>
4#include <CesiumGeometry/OrientedBoundingBox.h>
5#include <CesiumUtility/Math.h>
6
7#include <glm/gtc/quaternion.hpp>
8#include <glm/mat4x4.hpp>
9#include <glm/vec3.hpp>
10
11namespace CesiumGeometry {
12
13class Plane;
14enum class CullingResult;
15
27class CESIUMGEOMETRY_API BoundingCylinderRegion final {
28public:
56 const glm::dvec3& translation,
57 const glm::dquat& rotation,
58 double height,
59 const glm::dvec2& radialBounds,
60 const glm::dvec2& angularBounds = {
63
67 constexpr const glm::dvec3& getCenter() const noexcept {
68 return this->_box.getCenter();
69 }
70
75 constexpr const glm::dvec3& getTranslation() const noexcept {
76 return this->_translation;
77 }
78
83 constexpr const glm::dquat& getRotation() const noexcept {
84 return this->_rotation;
85 }
86
90 constexpr double getHeight() const noexcept { return this->_height; }
91
95 constexpr const glm::dvec2& getRadialBounds() const noexcept {
96 return this->_radialBounds;
97 }
98
102 constexpr const glm::dvec2& getAngularBounds() const noexcept {
103 return this->_angularBounds;
104 }
105
117 CullingResult intersectPlane(const Plane& plane) const noexcept;
118
128 double
129 computeDistanceSquaredToPosition(const glm::dvec3& position) const noexcept;
130
138 bool contains(const glm::dvec3& position) const noexcept;
139
148 transform(const glm::dmat4& transformation) const noexcept;
149
154
155private:
156 glm::dvec3 _translation;
157 glm::dquat _rotation;
158 double _height;
159 glm::dvec2 _radialBounds;
160 glm::dvec2 _angularBounds;
161
167};
168
169} // namespace CesiumGeometry
A bounding volume defined as a region following the surface of a cylinder between two radius values....
double computeDistanceSquaredToPosition(const glm::dvec3 &position) const noexcept
Computes the distance squared from a given position to the closest point on the bounding volume....
bool contains(const glm::dvec3 &position) const noexcept
Computes whether the given position is contained within the bounding cylinder.
constexpr const glm::dvec2 & getAngularBounds() const noexcept
Gets the angular bounds of the cylinder region.
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::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.
CullingResult intersectPlane(const Plane &plane) const noexcept
Determines on which side of a plane the bounding cylinder is located.
constexpr const glm::dvec2 & getRadialBounds() const noexcept
Gets the radial bounds of the 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.
OrientedBoundingBox toOrientedBoundingBox() const noexcept
Converts this bounding cylinder region to an oriented bounding box.
BoundingCylinderRegion transform(const glm::dmat4 &transformation) const noexcept
Transforms this bounding cylinder region to another coordinate system using a 4x4 matrix.
A bounding volume defined as a closed and convex cuboid with any orientation.
A plane in Hessian Normal Format.
Definition Plane.h:12
static constexpr double OnePi
Pi.
Definition Math.h:80
Basic geometry classes for Cesium.
CullingResult
The result of culling an object.