* @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. **/
| 677 | * along the bysector angle and separate the patch. |
| 678 | **/ |
| 679 | static bool |
| 680 | checkAnglesAndSplitIfNeeded(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 | |
| 707 | static void |
| 708 | tensor(const BezierCPs& p, |
no test coverage detected