MCPcopy Create free account
hub / github.com/andrewwillmott/splines-lib / FindSubSplineIntersections

Function FindSubSplineIntersections

Splines.cpp:1779–1851  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1777 }
1778
1779 int FindSubSplineIntersections
1780 (
1781 const SubSplineT2& spline0,
1782 const SubSplineT2& spline1,
1783 int dest,
1784 int maxDest,
1785 float results[][2],
1786 float tolerance
1787 )
1788 {
1789 SL_ASSERT(dest < maxDest);
1790
1791 Bounds2 bbox0 = ExactBounds(spline0.mSpline);
1792 Bounds2 bbox1 = ExactBounds(spline1.mSpline);
1793
1794 if (!Intersects(bbox0, bbox1))
1795 return dest;
1796
1797 if (Larger(bbox0, tolerance))
1798 {
1799 SubSplineT2 spline00, spline01;
1800 Split(spline0, &spline00, &spline01);
1801
1802 if (Larger(bbox1, tolerance))
1803 {
1804 SubSplineT2 spline10, spline11;
1805 Split(spline1, &spline10, &spline11);
1806
1807 dest = FindSubSplineIntersections(spline00, spline10, dest, maxDest, results, tolerance);
1808 if (dest < maxDest)
1809 dest = FindSubSplineIntersections(spline01, spline10, dest, maxDest, results, tolerance);
1810 if (dest < maxDest)
1811 dest = FindSubSplineIntersections(spline00, spline11, dest, maxDest, results, tolerance);
1812 if (dest < maxDest)
1813 dest = FindSubSplineIntersections(spline01, spline11, dest, maxDest, results, tolerance);
1814 }
1815 else
1816 {
1817 dest = FindSubSplineIntersections(spline00, spline1, dest, maxDest, results, tolerance);
1818 if (dest < maxDest)
1819 dest = FindSubSplineIntersections(spline01, spline1, dest, maxDest, results, tolerance);
1820 }
1821
1822 return dest;
1823 }
1824
1825 if (Larger(bbox1, tolerance))
1826 {
1827 SubSplineT2 spline10, spline11;
1828 Split(spline1, &spline10, &spline11);
1829
1830 dest = FindSubSplineIntersections(spline0, spline10, dest, maxDest, results, tolerance);
1831 if (dest < maxDest)
1832 dest = FindSubSplineIntersections(spline0, spline11, dest, maxDest, results, tolerance);
1833
1834 return dest;
1835 }
1836

Callers 2

FindSplineIntersectionsFunction · 0.85

Calls 3

IntersectsFunction · 0.85
LargerFunction · 0.85
SplitFunction · 0.85

Tested by

no test coverage detected