cesium-native 0.64.0
Loading...
Searching...
No Matches
BoundingSphere.h
1#pragma once
2
3#include <CesiumGeometry/CullingResult.h>
4#include <CesiumGeometry/Library.h>
5
6#include <glm/fwd.hpp>
7#include <glm/vec3.hpp>
8
9namespace CesiumGeometry {
10
11class Plane;
12
16class CESIUMGEOMETRY_API BoundingSphere final {
17public:
24 constexpr BoundingSphere(const glm::dvec3& center, double radius) noexcept
25 : _center(center), _radius(radius) {}
26
30 constexpr const glm::dvec3& getCenter() const noexcept {
31 return this->_center;
32 }
33
37 constexpr double getRadius() const noexcept { return this->_radius; }
38
51 CullingResult intersectPlane(const Plane& plane) const noexcept;
52
63 double
64 computeDistanceSquaredToPosition(const glm::dvec3& position) const noexcept;
65
73 bool contains(const glm::dvec3& position) const noexcept;
74
85 BoundingSphere transform(const glm::dmat4& transformation) const noexcept;
86
87private:
88 glm::dvec3 _center;
89 double _radius;
90};
91
92} // namespace CesiumGeometry
CullingResult intersectPlane(const Plane &plane) const noexcept
Determines on which side of a plane this boundings sphere is located.
bool contains(const glm::dvec3 &position) const noexcept
Computes whether the given position is contained within the bounding sphere.
constexpr const glm::dvec3 & getCenter() const noexcept
Gets the center of the bounding sphere.
constexpr BoundingSphere(const glm::dvec3 &center, double radius) noexcept
Construct a new instance.
double computeDistanceSquaredToPosition(const glm::dvec3 &position) const noexcept
Computes the distance squared from a position to the closest point on this bounding sphere....
constexpr double getRadius() const noexcept
Gets the radius of the bounding sphere.
BoundingSphere transform(const glm::dmat4 &transformation) const noexcept
Transforms this bounding sphere to another coordinate system using a 4x4 matrix.
A plane in Hessian Normal Format.
Definition Plane.h:12
Basic geometry classes for Cesium.
CullingResult
The result of culling an object.