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

Function checkAnglesAndSplitIfNeeded

Engine/CoonsRegularization.cpp:679–705  ·  view source on GitHub ↗

* @brief Given the original coon's patch, check if all interior angles are less than 180°. If not then we split * along the bysector angle and separate the patch. **/

Source from the content-addressed store, hash-verified

677 * along the bysector angle and separate the patch.
678 **/
679static bool
680checkAnglesAndSplitIfNeeded(const BezierCPs &cps,
681 double time,
682 int sign,
683 std::list<BezierCPs>* ret)
684{
685 int ncps = (int)cps.size();
686
687 assert(ncps >= 3);
688
689
690 for (int i = 0; i < ncps; ++i) {
691 Point negativeDir = dirVect(cps, time, i, -1);
692 negativeDir.y = -negativeDir.y;
693 Point positiveDir = dirVect(cps, time, i, 1);
694 double py = negativeDir.x * positiveDir.y + negativeDir.y * positiveDir.x;
695 if (py * sign < -1e-4) {
696 if ( splitAt(cps, time, i, ret) ) {
697 return true;
698 }
699
700 return false;
701 }
702 }
703
704 return false;
705}
706
707static void
708tensor(const BezierCPs& p,

Callers 1

regularizeMethod · 0.85

Calls 3

dirVectFunction · 0.85
splitAtFunction · 0.85
sizeMethod · 0.45

Tested by

no test coverage detected