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

Method regularize

Engine/CoonsRegularization.cpp:1379–1571  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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