Recast: use epsilon for vertical intersection tests

Take floating point precission into account.
This commit is contained in:
Kawe Mazidjatari 2024-11-02 20:09:14 +01:00
parent 1f4e7cc080
commit 2745f8b27c

View File

@ -261,7 +261,7 @@ bool rdIntersectSegmentCylinder(const float* sp, const float* sq, const float* p
// Vertical (z-axis) intersection test
const float dz = sq[2]-sp[2];
if (dz != 0.0f)
if (rdMathFabsf(dz) > RD_EPS)
{
float tCapMin = (cz-sp[2]) / dz;
float tCapMax = (topZ-sp[2]) / dz;
@ -303,7 +303,7 @@ bool rdIntersectSegmentConvexHull(const float* sp, const float* sq,
// Vertical (z-axis) intersection test
const float dz = sq[2]-sp[2];
if (dz != 0.0f)
if (rdMathFabsf(dz) > RD_EPS)
{
float tCapMin = (hmin-sp[2]) / dz;
float tCapMax = (hmax-sp[2]) / dz;