Fix intersectRayTriangle from GLM_GTX_intersect #1158

This commit is contained in:
Christophe 2023-12-20 23:11:41 +01:00 committed by Christophe
parent 1682a8c360
commit 2171a5b818

View File

@ -45,7 +45,7 @@ namespace glm
vec<3, T, Q> Perpendicular(0); vec<3, T, Q> Perpendicular(0);
if(det > std::numeric_limits<T>::epsilon()) if (det > static_cast<T>(0))
{ {
// calculate distance from vert0 to ray origin // calculate distance from vert0 to ray origin
vec<3, T, Q> const dist = orig - vert0; vec<3, T, Q> const dist = orig - vert0;
@ -63,7 +63,7 @@ namespace glm
if((baryPosition.y < static_cast<T>(0)) || ((baryPosition.x + baryPosition.y) > det)) if((baryPosition.y < static_cast<T>(0)) || ((baryPosition.x + baryPosition.y) > det))
return false; return false;
} }
else if(det < -std::numeric_limits<T>::epsilon()) else if(det < static_cast<T>(0))
{ {
// calculate distance from vert0 to ray origin // calculate distance from vert0 to ray origin
vec<3, T, Q> const dist = orig - vert0; vec<3, T, Q> const dist = orig - vert0;