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

Function checkstraight

Engine/CoonsRegularization.cpp:1270–1296  ·  view source on GitHub ↗

Return true if point z is on z0--z1; otherwise compute contribution to winding number.

Source from the content-addressed store, hash-verified

1268// Return true if point z is on z0--z1; otherwise compute contribution to
1269// winding number.
1270static
1271bool
1272checkstraight(const Point& z0,
1273 const Point& z1,
1274 const Point& z,
1275 int* count)
1276{
1277 if ( (z0.y <= z.y) && (z.y <= z1.y) ) {
1278 double side = orient2d(z0, z1, z);
1279 if ( (side == 0.0) && inrange(z0.x, z1.x, z.x) ) {
1280 return true;
1281 }
1282 if ( (z.y < z1.y) && (side > 0) ) {
1283 *count = *count + 1;
1284 }
1285 } else if ( (z1.y <= z.y) && (z.y <= z0.y) ) {
1286 double side = orient2d(z0, z1, z);
1287 if ( (side == 0.0) && inrange(z0.x, z1.x, z.x) ) {
1288 return true;
1289 }
1290 if ( (z.y < z0.y) && (side < 0) ) {
1291 *count = *count - 1;
1292 }
1293 }
1294
1295 return false;
1296}
1297
1298// returns true if point is on curve; otherwise compute contribution to
1299// winding number.

Callers 1

checkCurveFunction · 0.85

Calls 2

orient2dFunction · 0.85
inrangeFunction · 0.85

Tested by

no test coverage detected