Commit 7fc241ff authored by Philip Trettner's avatar Philip Trettner

ray coordinates

parent dd90a0d2
......@@ -3,7 +3,9 @@
#include <typed-geometry/detail/operators/ops_vec.hh>
#include <typed-geometry/types/array.hh>
#include <typed-geometry/types/objects/aabb.hh>
#include <typed-geometry/types/objects/box.hh>
#include <typed-geometry/types/objects/line.hh>
#include <typed-geometry/types/objects/plane.hh>
#include <typed-geometry/types/objects/ray.hh>
#include <typed-geometry/types/objects/segment.hh>
#include <typed-geometry/types/objects/triangle.hh>
......@@ -65,6 +67,18 @@ template <int D, class ScalarT>
return t;
}
template <int D, class ScalarT>
[[nodiscard]] constexpr ScalarT coordinates(ray<D, ScalarT> const& r, pos<D, ScalarT> const& p)
{
return dot(p - r.origin, r.dir);
}
template <int D, class ScalarT>
[[nodiscard]] constexpr ScalarT coordinates(line<D, ScalarT> const& l, pos<D, ScalarT> const& p)
{
return dot(p - l.pos, l.dir);
}
template <int D, class ScalarT, class TraitsT>
[[nodiscard]] constexpr comp<D, ScalarT> coordinates(aabb<D, ScalarT, TraitsT> const& s, pos<D, ScalarT> const& p)
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment