3 #include "Cartographic.h"
6 #include <CesiumUtility/Math.h>
8 #include <glm/vec3.hpp>
14 #ifndef CESIUM_DISABLE_DEFAULT_ELLIPSOID
19 #define CESIUM_DEFAULT_ELLIPSOID = CesiumGeospatial::Ellipsoid::WGS84
25 #define CESIUM_DEFAULT_ELLIPSOID
61 constexpr
Ellipsoid(
double x,
double y,
double z) noexcept
69 constexpr
Ellipsoid(
const glm::dvec3& radii) noexcept
71 _radiiSquared(radii.x * radii.x, radii.y * radii.y, radii.z * radii.z),
72 _oneOverRadii(1.0 / radii.x, 1.0 / radii.y, 1.0 / radii.z),
74 1.0 / (radii.x * radii.x),
75 1.0 / (radii.y * radii.y),
76 1.0 / (radii.z * radii.z)),
82 constexpr
const glm::dvec3&
getRadii() const noexcept {
return this->_radii; }
126 std::optional<Cartographic>
140 std::optional<glm::dvec3>
151 std::optional<glm::dvec3>
160 return glm::max(this->_radii.x, glm::max(this->_radii.y, this->_radii.z));
169 return glm::min(this->_radii.x, glm::min(this->_radii.y, this->_radii.z));
176 return this->_radii == rhs._radii;
183 return !(*
this == rhs);
188 glm::dvec3 _radiiSquared;
189 glm::dvec3 _oneOverRadii;
190 glm::dvec3 _oneOverRadiiSquared;
191 double _centerToleranceSquared;
A position defined by longitude, latitude, and height.
A quadratic surface defined in Cartesian coordinates.
static const Ellipsoid WGS84
An Ellipsoid instance initialized to the WGS84 standard.
constexpr const glm::dvec3 & getRadii() const noexcept
Returns the radii in x-, y-, and z-direction.
std::optional< Cartographic > cartesianToCartographic(const glm::dvec3 &cartesian) const noexcept
Converts the provided cartesian to a Cartographic representation.
constexpr double getMinimumRadius() const noexcept
The minimum radius in any dimension.
glm::dvec3 cartographicToCartesian(const Cartographic &cartographic) const noexcept
Converts the provided Cartographic to cartesian representation.
glm::dvec3 geodeticSurfaceNormal(const Cartographic &cartographic) const noexcept
Computes the normal of the plane tangent to the surface of the ellipsoid at the provided position.
constexpr bool operator!=(const Ellipsoid &rhs) const noexcept
Returns true if two elliposids are not equal.
constexpr bool operator==(const Ellipsoid &rhs) const noexcept
Returns true if two elliposids are equal.
constexpr Ellipsoid(double x, double y, double z) noexcept
Creates a new instance.
constexpr double getMaximumRadius() const noexcept
The maximum radius in any dimension.
static const Ellipsoid UNIT_SPHERE
An Ellipsoid with all three radii set to one meter.
std::optional< glm::dvec3 > scaleToGeocentricSurface(const glm::dvec3 &cartesian) const noexcept
Scales the provided cartesian position along the geocentric surface normal so that it is on the surfa...
constexpr Ellipsoid(const glm::dvec3 &radii) noexcept
Creates a new instance.
std::optional< glm::dvec3 > scaleToGeodeticSurface(const glm::dvec3 &cartesian) const noexcept
Scales the given cartesian position along the geodetic surface normal so that it is on the surface of...
glm::dvec3 geodeticSurfaceNormal(const glm::dvec3 &position) const noexcept
Computes the normal of the plane tangent to the surface of the ellipsoid at the provided position.
static constexpr double Epsilon1
0.1
Classes for geospatial computations in Cesium.