MCPcopy Create free account
hub / github.com/NatronGitHub/Natron / checkCurve

Function checkCurve

Engine/CoonsRegularization.cpp:1300–1342  ·  view source on GitHub ↗

returns true if point is on curve; otherwise compute contribution to winding number.

Source from the content-addressed store, hash-verified

1298// returns true if point is on curve; otherwise compute contribution to
1299// winding number.
1300static
1301bool
1302checkCurve(const Point& z0,
1303 const Point& c0,
1304 const Point& z1,
1305 const Point& c1,
1306 const Point& z,
1307 int* count,
1308 unsigned int depth)
1309{
1310 if (!depth) {
1311 return true;
1312 }
1313 --depth;
1314 if ( insidebbox(z0, c0, c1, z1, z) ) {
1315 Point m0, m1, m2, m3, m4, m5;
1316 m0.x = 0.5 * (z0.x + c0.x);
1317 m0.y = 0.5 * (z0.y + c0.y);
1318
1319 m1.x = 0.5 * (c0.x + c1.x);
1320 m1.y = 0.5 * (c0.y + c1.y);
1321
1322 m2.x = 0.5 * (c1.x + z1.x);
1323 m2.y = 0.5 * (c1.y + z1.y);
1324
1325 m3.x = 0.5 * (m0.x + m1.x);
1326 m3.y = 0.5 * (m0.y + m1.y);
1327
1328 m4.x = 0.5 * (m1.x + m2.x);
1329 m4.y = 0.5 * (m1.y + m2.y);
1330
1331 m5.x = 0.5 * (m3.x + m4.x);
1332 m5.y = 0.5 * (m3.y + m4.y);
1333 if ( checkCurve(z0, m0, m3, m5, z, count, depth) ||
1334 checkCurve(m5, m4, m2, z1, z, count, depth) ) {
1335 return true;
1336 }
1337 } else if ( checkstraight(z0, z1, z, count) ) {
1338 return true;
1339 }
1340
1341 return false;
1342}
1343
1344// Return the winding number of the region bounded by the (cyclic) path
1345// relative to the point z, or the largest odd integer if the point lies on

Callers 1

computeWindingNumberFunction · 0.85

Calls 2

insidebboxFunction · 0.85
checkstraightFunction · 0.85

Tested by

no test coverage detected