summaryrefslogtreecommitdiff
path: root/src/math.hpp
diff options
context:
space:
mode:
authorPaweł Redman <pawel.redman@gmail.com>2018-04-12 14:00:53 +0200
committerPaweł Redman <pawel.redman@gmail.com>2018-04-12 14:00:53 +0200
commita5b20dcd57ddf7bdac8d9bce1aabf934badd837d (patch)
treee05853e98e2481f5ac939919b58227190e1a07d0 /src/math.hpp
parent30c5c419aedd0e5aae92be6e0eee83f0b6690c6e (diff)
Ray tracing against cmodels (WIP).
Diffstat (limited to 'src/math.hpp')
-rw-r--r--src/math.hpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/math.hpp b/src/math.hpp
index 7cbd829..97e3b6b 100644
--- a/src/math.hpp
+++ b/src/math.hpp
@@ -379,6 +379,15 @@ public:
return v[0] / 2 + v[1] / 2;
}
+ bool contains(vec_t<T, N> &u) const
+ {
+ for (size_t i = 0; i < N; i++)
+ if (u[i] < v[0][i] || u[i] > v[1][i])
+ return false;
+
+ return true;
+ }
+
friend bool operator&&(const rect_t<T, N> &a, const rect_t<T, N> &b)
{
for (size_t i = 0; i < N; i++)