MCPcopy Create free account
hub / github.com/SaschaWillems/HowToVulkan / pnpoly

Function pnpoly

source/external/tinyobj/tiny_obj_loader.h:1451–1461  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1449// code from https://wrf.ecse.rpi.edu//Research/Short_Notes/pnpoly.html
1450template <typename T>
1451static int pnpoly(int nvert, T *vertx, T *verty, T testx, T testy) {
1452 int i, j, c = 0;
1453 for (i = 0, j = nvert - 1; i < nvert; j = i++) {
1454 if (((verty[i] > testy) != (verty[j] > testy)) &&
1455 (testx <
1456 (vertx[j] - vertx[i]) * (testy - verty[i]) / (verty[j] - verty[i]) +
1457 vertx[i]))
1458 c = !c;
1459 }
1460 return c;
1461}
1462
1463struct TinyObjPoint {
1464 real_t x, y, z;

Callers 1

exportGroupsToShapeFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected