Changed the polygon merging so that it does not generate parallel neighbor edges.

Added first version of Detour.
Changed the demo to use Detour.
This commit is contained in:
Mikko Mononen
2009-04-11 17:40:09 +00:00
parent ea8fb55a46
commit b93fe6b29a
8 changed files with 2054 additions and 4 deletions
+4 -4
View File
@@ -384,10 +384,10 @@ static int countPolyVerts(const unsigned short* p, const int nvp)
return nvp;
}
inline bool uleftOn(const unsigned short* a, const unsigned short* b, const unsigned short* c)
inline bool uleft(const unsigned short* a, const unsigned short* b, const unsigned short* c)
{
return ((int)b[0] - (int)a[0]) * ((int)c[2] - (int)a[2]) -
((int)c[0] - (int)a[0]) * ((int)b[2] - (int)a[2]) <= 0;
((int)c[0] - (int)a[0]) * ((int)b[2] - (int)a[2]) < 0;
}
static int getPolyMergeValue(unsigned short* pa, unsigned short* pb,
@@ -436,13 +436,13 @@ static int getPolyMergeValue(unsigned short* pa, unsigned short* pb,
va = pa[(ea+na-1) % na];
vb = pa[ea];
vc = pb[(eb+2) % nb];
if (!uleftOn(&verts[va*3], &verts[vb*3], &verts[vc*3]))
if (!uleft(&verts[va*3], &verts[vb*3], &verts[vc*3]))
return -1;
va = pb[(eb+nb-1) % nb];
vb = pb[eb];
vc = pa[(ea+2) % na];
if (!uleftOn(&verts[va*3], &verts[vb*3], &verts[vc*3]))
if (!uleft(&verts[va*3], &verts[vb*3], &verts[vc*3]))
return -1;
va = pa[ea];