Commit a23bdb40 authored by Julius NehringWirxel's avatar Julius NehringWirxel

Merge branch 'develop' of...

Merge branch 'develop' of into develop
parents b6fc632a 1a093c6c
......@@ -3,4 +3,5 @@
#include <typed-geometry/functions/random/gaussian.hh>
#include <typed-geometry/functions/random/random.hh>
#include <typed-geometry/functions/random/random_choice.hh>
#include <typed-geometry/functions/random/shuffle.hh>
#include <typed-geometry/functions/random/uniform.hh>
......@@ -540,6 +540,14 @@ template <class ScalarT>
return {};
template <class ScalarT>
[[nodiscard]] constexpr pos<2, ScalarT> intersection(line<2, ScalarT> const& l0, line<2, ScalarT> const& l1)
auto M = tg::mat<2, 2, ScalarT>::from_cols(l0.dir, -l1.dir);
auto t = inverse(M) * (l1.pos - l0.pos);
return l0[t.x];
template <int D, class ScalarT>
[[nodiscard]] constexpr optional<aabb<D, ScalarT>> intersection(aabb<D, ScalarT> const& a, aabb<D, ScalarT> const& b)
#pragma once
#include <typed-geometry/types/span.hh>
namespace tg
template <class Rng, class T>
constexpr void shuffle(Rng& rng, span<T> range)
for (size_t i = 1; i < range.size(); ++i)
auto j = rng() % (i + 1);
if (i != j)
detail::swap(range[i], range[j]);
template <class Rng, class Range>
constexpr void shuffle(Rng& rng, Range& range)
shuffle(rng, tg::span(range));
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