cesium-native  0.41.0
Plane.h
1 #pragma once
2 
3 #include "Library.h"
4 
5 #include <glm/vec3.hpp>
6 
7 namespace CesiumGeometry {
8 
12 class CESIUMGEOMETRY_API Plane final {
13 public:
17  static const Plane ORIGIN_XY_PLANE;
18 
22  static const Plane ORIGIN_YZ_PLANE;
23 
27  static const Plane ORIGIN_ZX_PLANE;
28 
32  Plane() noexcept;
33 
57  Plane(const glm::dvec3& normal, double distance);
58 
71  Plane(const glm::dvec3& point, const glm::dvec3& normal);
72 
76  const glm::dvec3& getNormal() const noexcept { return this->_normal; }
77 
86  double getDistance() const noexcept { return this->_distance; }
87 
98  double getPointDistance(const glm::dvec3& point) const noexcept;
99 
105  glm::dvec3 projectPointOntoPlane(const glm::dvec3& point) const noexcept;
106 
107 private:
108  glm::dvec3 _normal;
109  double _distance;
110 };
111 } // namespace CesiumGeometry
A plane in Hessian Normal Format.
Definition: Plane.h:12
static const Plane ORIGIN_ZX_PLANE
The ZX plane passing through the origin, with normal in positive Y.
Definition: Plane.h:27
double getPointDistance(const glm::dvec3 &point) const noexcept
Computes the signed shortest distance of a point to this plane. The sign of the distance determines w...
static const Plane ORIGIN_YZ_PLANE
The YZ plane passing through the origin, with normal in positive X.
Definition: Plane.h:22
Plane() noexcept
Constructs a new plane with a +Z normal and a distance of 0.0.
glm::dvec3 projectPointOntoPlane(const glm::dvec3 &point) const noexcept
Projects a point onto this plane.
double getDistance() const noexcept
Gets the signed shortest distance from the origin to the plane. The sign of distance determines which...
Definition: Plane.h:86
static const Plane ORIGIN_XY_PLANE
The XY plane passing through the origin, with normal in positive Z.
Definition: Plane.h:17
Basic geometry classes for Cesium.