Ray.hpp
Go to the documentation of this file.
1 // This code is based on Jet framework.
2 // Copyright (c) 2018 Doyub Kim
3 // CubbyFlow is voxel-based fluid simulation engine for computer games.
4 // Copyright (c) 2020 CubbyFlow Team
5 // Core Part: Chris Ohk, Junwoo Hwang, Jihong Sin, Seungwoo Yoo
6 // AI Part: Dongheon Cho, Minseo Kim
7 // We are making my contributions/submissions to this project solely in our
8 // personal capacity and are not conveying any rights to any intellectual
9 // property of any third parties.
10 
11 #ifndef CUBBYFLOW_RAY_HPP
12 #define CUBBYFLOW_RAY_HPP
13 
14 #include <Core/Matrix/Matrix.hpp>
15 
16 namespace CubbyFlow
17 {
24 template <typename T, size_t N>
25 class Ray final
26 {
27  public:
28  static_assert(N > 0, "Dimension should be greater than 0");
29  static_assert(std::is_floating_point<T>::value,
30  "Ray only can be instantiated with floating point types");
31 
33 
36 
39 
41  Ray();
42 
44  Ray(const VectorType& newOrigin, const VectorType& newDirection);
45 
47  ~Ray() = default;
48 
50  Ray(const Ray& other);
51 
53  Ray(Ray&& other) noexcept;
54 
56  Ray& operator=(const Ray& other);
57 
59  Ray& operator=(Ray&& other) noexcept;
60 
62  [[nodiscard]] VectorType PointAt(T t) const;
63 };
64 
65 template <typename T>
66 using Ray2 = Ray<T, 2>;
67 
68 template <typename T>
69 using Ray3 = Ray<T, 3>;
70 
72 
74 
76 
78 } // namespace CubbyFlow
79 
81 
82 #endif
VectorType origin
The origin of the ray.
Definition: Ray.hpp:35
Class for N-D ray.
Definition: Ray.hpp:25
VectorType PointAt(T t) const
Returns a point on the ray at distance t.
Definition: Ray-Impl.hpp:60
Definition: Matrix.hpp:27
Definition: pybind11Utils.hpp:20
~Ray()=default
Default destructor.
VectorType direction
The direction of the ray.
Definition: Ray.hpp:38
Ray()
Constructs an empty ray that points (1, 0, ...) from (0, 0, ...).
Definition: Ray-Impl.hpp:17
Ray & operator=(const Ray &other)
Copy assignment operator.
Definition: Ray-Impl.hpp:44