opynsim
Unofficial C++ Documentation
Loading...
Searching...
No Matches
ray.h
Go to the documentation of this file.
1#pragma once
2
5
6#include <iosfwd>
7
8namespace osc { template<typename T, size_t C, size_t R> struct Matrix; }
9namespace osc { struct Transform; }
10
11namespace osc
12{
13 // an infinitely long object with no width with an origin position and direction in 3D space
14 //
15 // - see `LineSegment` for the finite version of this
16 // - sometimes called `Ray` in the literature
17 struct Ray final {
18 friend bool operator==(const Ray&, const Ray&) = default;
19
21 Vector3 direction = {0.0f, 1.0f, 0.0f};
22 };
23
24 std::ostream& operator<<(std::ostream&, const Ray&);
25
26 // Returns `true` if `a` and `b` lie on the same mathematical line
27 // and point in the same direction to within some (dot-product-defined)
28 // tolerance.
30 const Ray& a,
31 const Ray& b,
32 float tolerance = epsilon_v<float>
33 );
34
35 // returns a `Ray` that has been transformed by the matrix.
37
38 // returns a `Ray` that has been transformed by the inverse of the supplied `Transform`
40}
Definition custom_decoration_generator.h:5
std::ostream & operator<<(std::ostream &, const Object &)
bool is_colinear_and_codirectional(const Ray &a, const Ray &b, float tolerance=epsilon_v< float >)
Ray inverse_transform_ray(const Ray &, const Transform &)
Ray transform_ray(const Ray &, const Matrix< float, 4, 4 > &)
Definition matrix.h:15
Definition ray.h:17
Vector3 origin
Definition ray.h:20
friend bool operator==(const Ray &, const Ray &)=default
Vector3 direction
Definition ray.h:21
Definition transform.h:11