cesium-native  0.41.0
Ray.h
1 #pragma once
2 
3 #include "Library.h"
4 
5 #include <glm/fwd.hpp>
6 #include <glm/vec3.hpp>
7 
8 namespace CesiumGeometry {
9 
14 class CESIUMGEOMETRY_API Ray final {
15 public:
24  Ray(const glm::dvec3& origin, const glm::dvec3& direction);
25 
29  const glm::dvec3& getOrigin() const noexcept { return this->_origin; }
30 
34  const glm::dvec3& getDirection() const noexcept { return this->_direction; }
35 
43  glm::dvec3 pointFromDistance(double distance) const noexcept;
44 
52  Ray transform(const glm::dmat4x4& transformation) const noexcept;
53 
57  Ray operator-() const noexcept;
58 
59 private:
60  glm::dvec3 _origin;
61  glm::dvec3 _direction;
62 };
63 } // namespace CesiumGeometry
A ray that extends infinitely from the provided origin in the provided direction.
Definition: Ray.h:14
glm::dvec3 pointFromDistance(double distance) const noexcept
Calculates a point on the ray that corresponds to the given distance from origin. Can be positive,...
Ray operator-() const noexcept
Constructs a new ray with its direction opposite this one.
Ray transform(const glm::dmat4x4 &transformation) const noexcept
Transforms the ray using a given 4x4 transformation matrix.
Ray(const glm::dvec3 &origin, const glm::dvec3 &direction)
Construct a new ray.
const glm::dvec3 & getOrigin() const noexcept
Gets the origin of the ray.
Definition: Ray.h:29
const glm::dvec3 & getDirection() const noexcept
Gets the direction of the ray.
Definition: Ray.h:34
Basic geometry classes for Cesium.