summaryrefslogtreecommitdiff
path: root/core/math/face3.h
diff options
context:
space:
mode:
Diffstat (limited to 'core/math/face3.h')
-rw-r--r--core/math/face3.h15
1 files changed, 10 insertions, 5 deletions
diff --git a/core/math/face3.h b/core/math/face3.h
index eb2b3b8bd5..fb40e8ab9e 100644
--- a/core/math/face3.h
+++ b/core/math/face3.h
@@ -111,8 +111,9 @@ bool Face3::intersects_aabb2(const AABB &p_aabb) const {
real_t dist_a = perp.dot(ofs + sup) - d;
real_t dist_b = perp.dot(ofs - sup) - d;
- if (dist_a * dist_b > 0)
+ if (dist_a * dist_b > 0) {
return false; //does not intersect the plane
+ }
#define TEST_AXIS(m_ax) \
{ \
@@ -209,8 +210,9 @@ bool Face3::intersects_aabb2(const AABB &p_aabb) const {
Vector3 axis = vec3_cross(e1, e2);
- if (axis.length_squared() < 0.0001)
+ if (axis.length_squared() < 0.0001) {
continue; // coplanar
+ }
//axis.normalize();
Vector3 sup2 = Vector3(
@@ -228,15 +230,18 @@ bool Face3::intersects_aabb2(const AABB &p_aabb) const {
for (int k = 0; k < 3; k++) {
real_t vert_d = axis.dot(vertex[k]);
- if (vert_d > maxT)
+ if (vert_d > maxT) {
maxT = vert_d;
+ }
- if (vert_d < minT)
+ if (vert_d < minT) {
minT = vert_d;
+ }
}
- if (maxB < minT || maxT < minB)
+ if (maxB < minT || maxT < minB) {
return false;
+ }
}
}
return true;