cesium-native  0.41.0
EllipsoidTangentPlane.h
1 #pragma once
2 
3 #include "Ellipsoid.h"
4 #include "Library.h"
5 
6 #include <CesiumGeometry/Plane.h>
7 
8 #include <glm/fwd.hpp>
9 #include <glm/vec2.hpp>
10 #include <glm/vec3.hpp>
11 
12 namespace CesiumGeospatial {
13 
20 class CESIUMGEOSPATIAL_API EllipsoidTangentPlane final {
21 public:
31  const glm::dvec3& origin,
32  const Ellipsoid& ellipsoid CESIUM_DEFAULT_ELLIPSOID);
33 
42  const glm::dmat4& eastNorthUpToFixedFrame,
43  const Ellipsoid& ellipsoid CESIUM_DEFAULT_ELLIPSOID);
44 
48  const Ellipsoid& getEllipsoid() const noexcept { return this->_ellipsoid; }
49 
53  const glm::dvec3& getOrigin() const noexcept { return this->_origin; }
54 
58  const glm::dvec3& getXAxis() const noexcept { return this->_xAxis; }
59 
63  const glm::dvec3& getYAxis() const noexcept { return this->_yAxis; }
64 
68  const glm::dvec3& getZAxis() const noexcept {
69  return this->_plane.getNormal();
70  }
71 
76  const CesiumGeometry::Plane& getPlane() const noexcept {
77  return this->_plane;
78  }
79 
92  glm::dvec2
93  projectPointToNearestOnPlane(const glm::dvec3& cartesian) const noexcept;
94 
95 private:
101  static glm::dmat4 computeEastNorthUpToFixedFrame(
102  const glm::dvec3& origin,
103  const Ellipsoid& ellipsoid CESIUM_DEFAULT_ELLIPSOID);
104 
105  Ellipsoid _ellipsoid;
106  glm::dvec3 _origin;
107  glm::dvec3 _xAxis;
108  glm::dvec3 _yAxis;
109  CesiumGeometry::Plane _plane;
110 };
111 
112 } // namespace CesiumGeospatial
A plane in Hessian Normal Format.
Definition: Plane.h:12
A plane tangent to an Ellipsoid at a certain origin position.
const Ellipsoid & getEllipsoid() const noexcept
Returns the Ellipsoid.
const glm::dvec3 & getZAxis() const noexcept
Returns the z-axis (i.e. the normal) of this plane.
glm::dvec2 projectPointToNearestOnPlane(const glm::dvec3 &cartesian) const noexcept
Computes the position of the projection of the given point on this plane.
const glm::dvec3 & getYAxis() const noexcept
Returns the y-axis of this plane.
EllipsoidTangentPlane(const glm::dmat4 &eastNorthUpToFixedFrame, const Ellipsoid &ellipsoid CESIUM_DEFAULT_ELLIPSOID)
Creates a new instance.
const glm::dvec3 & getOrigin() const noexcept
Returns the origin, in cartesian coordinates.
const CesiumGeometry::Plane & getPlane() const noexcept
Returns a CesiumGeometry::Plane representation of this plane.
EllipsoidTangentPlane(const glm::dvec3 &origin, const Ellipsoid &ellipsoid CESIUM_DEFAULT_ELLIPSOID)
Creates a new instance.
const glm::dvec3 & getXAxis() const noexcept
Returns the x-axis of this plane.
A quadratic surface defined in Cartesian coordinates.
Definition: Ellipsoid.h:38
Classes for geospatial computations in Cesium.