cesium-native  0.41.0
LocalHorizontalCoordinateSystem.h
1 #pragma once
2 
3 #include "Ellipsoid.h"
4 #include "Library.h"
5 
6 #include <glm/mat4x4.hpp>
7 #include <glm/vec3.hpp>
8 
9 namespace CesiumGeospatial {
10 class Cartographic;
11 }
12 
13 namespace CesiumGeospatial {
14 
15 enum class LocalDirection { East, North, West, South, Up, Down };
16 
25 class CESIUMGEOSPATIAL_API LocalHorizontalCoordinateSystem {
26 public:
44  const Cartographic& origin,
45  LocalDirection xAxisDirection = LocalDirection::East,
46  LocalDirection yAxisDirection = LocalDirection::North,
47  LocalDirection zAxisDirection = LocalDirection::Up,
48  double scaleToMeters = 1.0,
49  // Can't use CESIUM_DEFAULT_ELLIPSOID here because of the other default
50  // parameters
52 
70  const glm::dvec3& originEcef,
71  LocalDirection xAxisDirection = LocalDirection::East,
72  LocalDirection yAxisDirection = LocalDirection::North,
73  LocalDirection zAxisDirection = LocalDirection::Up,
74  double scaleToMeters = 1.0,
76 
90  explicit LocalHorizontalCoordinateSystem(const glm::dmat4& localToEcef);
91 
110  const glm::dmat4& localToEcef,
111  const glm::dmat4& ecefToLocal);
112 
120  const glm::dmat4& getLocalToEcefTransformation() const noexcept {
121  return this->_localToEcef;
122  }
123 
131  const glm::dmat4& getEcefToLocalTransformation() const noexcept {
132  return this->_ecefToLocal;
133  };
134 
142  glm::dvec3
143  localPositionToEcef(const glm::dvec3& localPosition) const noexcept;
144 
153  glm::dvec3 ecefPositionToLocal(const glm::dvec3& ecefPosition) const noexcept;
154 
165  glm::dvec3
166  localDirectionToEcef(const glm::dvec3& localDirection) const noexcept;
167 
179  glm::dvec3
180  ecefDirectionToLocal(const glm::dvec3& ecefDirection) const noexcept;
181 
193  const LocalHorizontalCoordinateSystem& target) const noexcept;
194 
195 private:
196  glm::dmat4 _ecefToLocal;
197  glm::dmat4 _localToEcef;
198 };
199 
200 } // namespace CesiumGeospatial
A position defined by longitude, latitude, and height.
Definition: Cartographic.h:12
A quadratic surface defined in Cartesian coordinates.
Definition: Ellipsoid.h:38
static const Ellipsoid WGS84
An Ellipsoid instance initialized to the WGS84 standard.
Definition: Ellipsoid.h:47
A coordinate system created from a local horizontal plane at a particular origin point on the globe.
LocalHorizontalCoordinateSystem(const glm::dmat4 &localToEcef, const glm::dmat4 &ecefToLocal)
Create a new coordinate system with the specified transformations between the local frame and the Ear...
glm::dvec3 ecefDirectionToLocal(const glm::dvec3 &ecefDirection) const noexcept
Converts a direction in the Earth-Centered, Earth-Fixed (ECEF) coordinate system to the local horizon...
const glm::dmat4 & getEcefToLocalTransformation() const noexcept
Gets the transformation matrix from the Earth-Centered, Earth-Fixed (ECEF) coordinate system to the l...
glm::dvec3 localPositionToEcef(const glm::dvec3 &localPosition) const noexcept
Converts a position in the local horizontal coordinate system managed by this instance to Earth-Cente...
glm::dvec3 ecefPositionToLocal(const glm::dvec3 &ecefPosition) const noexcept
Converts a position in the Earth-Centered, Earth-Fixed (ECEF) coordinate system to the local horizont...
glm::dvec3 localDirectionToEcef(const glm::dvec3 &localDirection) const noexcept
Converts a direction in the local horizontal coordinate system managed by this instance to Earth-Cent...
LocalHorizontalCoordinateSystem(const Cartographic &origin, LocalDirection xAxisDirection=LocalDirection::East, LocalDirection yAxisDirection=LocalDirection::North, LocalDirection zAxisDirection=LocalDirection::Up, double scaleToMeters=1.0, const Ellipsoid &ellipsoid=CesiumGeospatial::Ellipsoid::WGS84)
Create a new coordinate system centered at a given longitude, latitude, and ellipsoidal height.
LocalHorizontalCoordinateSystem(const glm::dmat4 &localToEcef)
Create a new coordinate system with a specified transformation to the Earth-Centered,...
glm::dmat4 computeTransformationToAnotherLocal(const LocalHorizontalCoordinateSystem &target) const noexcept
Computes the transformation matrix from this local horizontal coordinate system to another one....
const glm::dmat4 & getLocalToEcefTransformation() const noexcept
Gets the transformation matrix from the local horizontal coordinate system managed by this instance t...
LocalHorizontalCoordinateSystem(const glm::dvec3 &originEcef, LocalDirection xAxisDirection=LocalDirection::East, LocalDirection yAxisDirection=LocalDirection::North, LocalDirection zAxisDirection=LocalDirection::Up, double scaleToMeters=1.0, const Ellipsoid &ellipsoid=CesiumGeospatial::Ellipsoid::WGS84)
Create a new coordinate system centered at a Earth-Centered, Earth-Fixed position.
Classes for geospatial computations in Cesium.