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>
31 : origin(other.origin), direction(other.direction)
32{
33 // Do nothing
34}
35
36template <typename T, size_t N>
38 : origin(std::move(other.origin)), direction(std::move(other.direction))
39{
40 // Do nothing
41}
42
43template <typename T, size_t N>
45{
46 origin = other.origin;
47 direction = other.direction;
48 return *this;
49}
50
51template <typename T, size_t N>
53{
54 origin = std::move(other.origin);
55 direction = std::move(other.direction);
56 return *this;
57}
58
59template <typename T, size_t N>
61{
62 return origin + t * direction;
63}
64} // namespace CubbyFlow
65
66#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.
Definition Ray-Impl.hpp:44
VectorType PointAt(T t) const
Returns a point on the ray at distance t.
Definition Ray-Impl.hpp:60
Ray()
Constructs an empty ray that points (1, 0, ...) from (0, 0, ...).
Definition Ray-Impl.hpp:17
Definition pybind11Utils.hpp:21
Matrix< T, Rows, 1 > Vector
Definition Matrix.hpp:738