MCPcopy Create free account
hub / github.com/FlaxEngine/FlaxEngine / diagonalie

Function diagonalie

Source/ThirdParty/recastnavigation/RecastMesh.cpp:242–265  ·  view source on GitHub ↗

Returns T iff (v_i, v_j) is a proper internal *or* external diagonal of P, *ignoring edges incident to v_i and v_j*.

Source from the content-addressed store, hash-verified

240// Returns T iff (v_i, v_j) is a proper internal *or* external
241// diagonal of P, *ignoring edges incident to v_i and v_j*.
242static bool diagonalie(int i, int j, int n, const int* verts, int* indices)
243{
244 const int* d0 = &verts[(indices[i] & 0x0fffffff) * 4];
245 const int* d1 = &verts[(indices[j] & 0x0fffffff) * 4];
246
247 // For each edge (k,k+1) of P
248 for (int k = 0; k < n; k++)
249 {
250 int k1 = next(k, n);
251 // Skip edges incident to i or j
252 if (!((k == i) || (k1 == i) || (k == j) || (k1 == j)))
253 {
254 const int* p0 = &verts[(indices[k] & 0x0fffffff) * 4];
255 const int* p1 = &verts[(indices[k1] & 0x0fffffff) * 4];
256
257 if (vequal(d0, p0) || vequal(d1, p0) || vequal(d0, p1) || vequal(d1, p1))
258 continue;
259
260 if (intersect(d0, d1, p0, p1))
261 return false;
262 }
263 }
264 return true;
265}
266
267// Returns true iff the diagonal (i,j) is strictly internal to the
268// polygon P in the neighborhood of the i endpoint.

Callers 1

diagonalFunction · 0.70

Calls 3

nextFunction · 0.70
vequalFunction · 0.70
intersectFunction · 0.70

Tested by

no test coverage detected