Recast: use the correct epsilon value

Seems to generate slightly better results with next to no extra performance cost.
This commit is contained in:
Kawe Mazidjatari 2024-08-11 11:41:36 +02:00
parent 50b982e733
commit 2bc4dc9c3f

View File

@ -381,8 +381,6 @@ static bool overlapEdges(const float* pts, const int* edges, int nedges, int s1,
static void completeFacet(rcContext* ctx, const float* pts, int npts, int* edges, int& nedges, const int maxEdges, int& nfaces, int e) static void completeFacet(rcContext* ctx, const float* pts, int npts, int* edges, int& nedges, const int maxEdges, int& nfaces, int e)
{ {
static const float EPS = 1e-5f; // todo(amos): typo? use RD_EPS (1e-6f)?
int* edge = &edges[e*4]; int* edge = &edges[e*4];
// Cache s and t. // Cache s and t.
@ -424,9 +422,9 @@ static void completeFacet(rcContext* ctx, const float* pts, int npts, int* edges
{ {
if (u == s || u == t) continue; if (u == s || u == t) continue;
#if 0 #if 0
if (vcross2(&pts[t*3], &pts[s*3], &pts[u*3]) > EPS) if (vcross2(&pts[t*3], &pts[s*3], &pts[u*3]) > RD_EPS)
#else #else
if (vcross2(&pts[s*3], &pts[t*3], &pts[u*3]) > EPS) if (vcross2(&pts[s*3], &pts[t*3], &pts[u*3]) > RD_EPS)
#endif #endif
{ {
if (r < 0) if (r < 0)