From 6fbebe0eb78f1187bf3a08501478d9d2daecdad0 Mon Sep 17 00:00:00 2001 From: Jack Andersen Date: Sun, 3 Jun 2018 15:03:54 -1000 Subject: [PATCH] Fix closest/furthest point functions for CAABox --- include/zeus/CAABox.hpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/include/zeus/CAABox.hpp b/include/zeus/CAABox.hpp index cf77540..f6d5aef 100644 --- a/include/zeus/CAABox.hpp +++ b/include/zeus/CAABox.hpp @@ -265,16 +265,16 @@ public: inline CVector3f closestPointAlongVector(const CVector3f& other) const { - CVector3f center = this->center(); - return {(other.x < center.x ? min.x : max.x), (other.y < center.y ? min.y : max.y), - (other.z < center.z ? min.z : max.z)}; + return {(other.x >= 0.f ? min.x : max.x), + (other.y >= 0.f ? min.y : max.y), + (other.z >= 0.f ? min.z : max.z)}; } inline CVector3f furthestPointAlongVector(const CVector3f& other) const { - CVector3f center = this->center(); - return {(other.x < center.x ? max.x : min.x), (other.y < center.y ? max.y : min.y), - (other.z < center.z ? max.z : min.z)}; + return {(other.x >= 0.f ? max.x : min.x), + (other.y >= 0.f ? max.y : min.y), + (other.z >= 0.f ? max.z : min.z)}; } inline float distanceBetween(const CAABox& other)