Loading...
Searching...
No Matches
Ray-Impl.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_IMPL_HPP
12#define CUBBYFLOW_RAY_IMPL_HPP
13
14namespace CubbyFlow
15{
16template <typename T, size_t N>
17Ray<T, N>::Ray() : origin(VectorType{}), direction(VectorType{})
18{
19 direction[0] = 1;
20}
21
22template <typename T, size_t N>
24 : origin(newOrigin), direction(newDirection.Normalized())
25{
26 // Do nothing
27}
28
29template <typename T, size_t N>
30Ray<T, N>::Ray(const Ray& other) = default;
31
32template <typename T, size_t N>
33Ray<T, N>::Ray(Ray&& other) noexcept = default;
34
35template <typename T, size_t N>
36Ray<T, N>& Ray<T, N>::operator=(const Ray& other) = default;
37
38template <typename T, size_t N>
39Ray<T, N>& Ray<T, N>::operator=(Ray&& other) noexcept = default;
40
41template <typename T, size_t N>
43{
44 return origin + t * direction;
45}
46} // namespace CubbyFlow
47
48#endif
Definition Matrix.hpp:30
Class for N-D ray.
Definition Ray.hpp:26
VectorType direction
The direction of the ray.
Definition Ray.hpp:38
Ray & operator=(const Ray &other)
Copy assignment operator.
VectorType PointAt(T t) const
Returns a point on the ray at distance t.
Definition Ray-Impl.hpp:42
Ray()
Constructs an empty ray that points (1, 0, ...) from (0, 0, ...).
Definition Ray-Impl.hpp:17
Definition pybind11Utils.hpp:22