From a5b20dcd57ddf7bdac8d9bce1aabf934badd837d Mon Sep 17 00:00:00 2001 From: Paweł Redman Date: Thu, 12 Apr 2018 14:00:53 +0200 Subject: Ray tracing against cmodels (WIP). --- src/math.hpp | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/math.hpp') 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 &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 &a, const rect_t &b) { for (size_t i = 0; i < N; i++) -- cgit