MCPcopy Create free account
hub / github.com/MrKepzie/Natron / regularize

Method regularize

Engine/CoonsRegularization.cpp:1378–1570  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1376}
1377
1378void
1379CoonsRegularization::regularize(const BezierCPs &patch,
1380 double time,
1381 std::list<BezierCPs> *fixedPatch)
1382{
1383 if (patch.size() < 3) {
1384 fixedPatch->push_back(patch);
1385
1386 return;
1387 }
1388
1389 Point pointInside = findPointInside(patch, time);
1390 int sign;
1391 {
1392 RectD bbox;
1393 bbox.x1 = std::numeric_limits<double>::infinity();
1394 bbox.x2 = -std::numeric_limits<double>::infinity();
1395 bbox.y1 = std::numeric_limits<double>::infinity();
1396 bbox.y2 = -std::numeric_limits<double>::infinity();
1397 Bezier::bezierSegmentListBboxUpdate(false, patch, true, false, time, ViewIdx(0), 0, Transform::Matrix3x3(), &bbox);
1398 if ( !bbox.contains(pointInside.x, pointInside.y) ) {
1399 sign = 0;
1400 } else {
1401 int winding_number = computeWindingNumber(patch, time, pointInside);
1402 sign = (winding_number < 0) ? -1 : ( (winding_number > 0) ? 1 : 0 );
1403 }
1404 }
1405 std::list<BezierCPs> splits;
1406 if ( checkAnglesAndSplitIfNeeded(patch, time, sign, &splits) ) {
1407 *fixedPatch = splits;
1408
1409 return;
1410 }
1411
1412 Point P[4][4];
1413 coonsPatch(patch, time, P);
1414
1415 //Check for degeneracy
1416 Point U[3][4];
1417 Point V[4][3];
1418
1419 for (int i = 0; i < 3; ++i) {
1420 for (int j = 0; j < 4; ++j) {
1421 U[i][j].x = P[i + 1][j].x - P[i][j].x;
1422 U[i][j].y = P[i + 1][j].y - P[i][j].y;
1423 }
1424 }
1425 for (int i = 0; i < 4; ++i) {
1426 for (int j = 0; j < 3; ++j) {
1427 V[i][j].x = P[i][j + 1].x - P[i][j].x;
1428 V[i][j].y = P[i][j + 1].y - P[i][j].y;
1429 }
1430 }
1431
1432 int choose2[3] = {1, 2, 1};
1433 int choose3[4] = {1, 3, 3, 1};
1434 double T[6][6];
1435 for (int p = 0; p < 6; ++p) {

Callers

nothing calls this directly

Calls 14

findPointInsideFunction · 0.85
computeWindingNumberFunction · 0.85
coonsPatchFunction · 0.85
maxFunction · 0.85
solveQuarticFunction · 0.85
normalFunction · 0.85
splitAtFunction · 0.85
ViewIdxClass · 0.70
Matrix3x3Class · 0.70
sqrtFunction · 0.50
sizeMethod · 0.45

Tested by

no test coverage detected