Presentation is loading. Please wait.

Presentation is loading. Please wait.

Efficient Methods for Roots of Univariate Scalar Beziers

Similar presentations


Presentation on theme: "Efficient Methods for Roots of Univariate Scalar Beziers"β€” Presentation transcript:

1 Efficient Methods for Roots of Univariate Scalar Beziers
Jinesh Machchhar and Gershon Elber Faculty of Computer Science, Technion-Israel Institute of Technology Center for Graphics and Geometric Computing, Technion

2 Center for Graphics and Geometric Computing, Technion
Outline Motivation Traditional approach Our approach Results Extension to B-splines Extension w/o subdivision Discussion Center for Graphics and Geometric Computing, Technion

3 Center for Graphics and Geometric Computing, Technion
Zeros of polynomials Defining manifolds implicitly: E.g. π‘₯ 2 +3 𝑦 2 βˆ’1=0 Offsets, blends, Minkowski-sums: Intersection of manifolds: Kinematic analysis/synthesis: Center for Graphics and Geometric Computing, Technion

4 Center for Graphics and Geometric Computing, Technion
Previous methods Some roots are complex, in this work we look only for real roots. The analytic method gives exact roots of polynomials with degree up to 5. Numeric methods such as Newton-Raphson cannot locate all the roots in interval. Sub-division based methods: Recursively sub-divide the interval until: Absence of roots is guaranteed in the sub-interval, or Exactly one root is guaranteed in the sub-interval. J. Lane and R. Riesenfeld. Bounds on a polynomial, 1981. T. Sederberg and S. Parry. Comparison of three curve intersection algorithms, 1986. Center for Graphics and Geometric Computing, Technion

5 The Subdivision approaches
Traditional approach Our approach Subdivide at arbitrary location as long as topology not clear (until we verify a single or no solution). We guess a solution (via NR) and exploit the mathematical representation of Bezier with a root at its end. Hence the subdivision is converging slower than can be hoped for (like the bisection method). The high chances of successful guessing and the degree reduction from eliminating the root gives about a x10 boost. Center for Graphics and Geometric Computing, Technion

6 Our approach: Locate a root
Assume root at 𝑑 2 is found. 𝑑 1 𝑑 2 𝑐(𝑑) Center for Graphics and Geometric Computing, Technion

7 Our approach: factoring out roots
Lemma: A degree 𝑛 scalar Bernstein polynomial 𝑐 𝑑 = 𝑖=0 𝑛 𝑝 𝑖 πœƒ 𝑖,𝑛 such that 𝑐 0 =0 can be written as 𝑐 𝑑 =𝑑 𝑖=0 π‘›βˆ’1 π‘ž 𝑖 πœƒ 𝑖,π‘›βˆ’1 =𝑑 π‘Ÿ(𝑑), where, π‘ž 𝑖 = 𝑝 𝑖+1 𝑛 𝑖+1 for 𝑖=0, …,π‘›βˆ’1. β†’ 𝑐(𝑑) π‘Ÿ 𝑑 Degree reduction: 𝑐 𝑑 of degree 𝑛, π‘Ÿ 𝑑 of degree π‘›βˆ’1. Similarly, when 𝑐 1 =0, 𝑐 𝑑 = 1βˆ’π‘‘ π‘Ÿ 𝑑 , π‘Ÿ 𝑑 of degree π‘›βˆ’1. Center for Graphics and Geometric Computing, Technion

8 Our approach: factoring out roots
Proof: Since 𝑐 0 =0, the first coefficient, 𝑝 0 , is zero, and we have, 𝑐 𝑑 = 𝑖=0 𝑛 𝑝 𝑖 𝑛 𝑖 𝑑 𝑖 1βˆ’π‘‘ π‘›βˆ’π‘– , = 𝑖=1 𝑛 𝑝 𝑖 𝑛 𝑖 𝑑 𝑖 1βˆ’π‘‘ π‘›βˆ’π‘– , =𝑑 𝑖=1 𝑛 𝑝 𝑖 𝑛 𝑖 𝑑 π‘–βˆ’1 1βˆ’π‘‘ π‘›βˆ’π‘– , cont’d.. Center for Graphics and Geometric Computing, Technion

9 Our approach: factoring out roots
Proof: cont’d. 𝑐 𝑑 =𝑑 𝑖=1 𝑛 𝑝 𝑖 𝑛 𝑖 𝑑 π‘–βˆ’1 1βˆ’π‘‘ π‘›βˆ’π‘– , =𝑑 𝑖=0 π‘›βˆ’1 𝑝 𝑖+1 𝑛 𝑖+1 𝑑 𝑖 1βˆ’π‘‘ π‘›βˆ’π‘–βˆ’1 , =𝑑 𝑖=0 π‘›βˆ’1 𝑝 𝑖+1 𝑛 𝑖+1 π‘›βˆ’1 𝑖 𝑑 𝑖 1βˆ’π‘‘ π‘›βˆ’π‘–βˆ’1 , =𝑑 𝑖=0 π‘›βˆ’1 π‘ž 𝑖 πœƒ 𝑖,π‘›βˆ’1 𝑑 , =π‘‘π‘Ÿ 𝑑 . Center for Graphics and Geometric Computing, Technion

10 Our approach: Sub-divide at root
𝑐 𝑑 is subdivided at 𝑑 2 . 𝑑 1 𝑑 2 𝑐(𝑑) Center for Graphics and Geometric Computing, Technion

11 Our approach: Sub-divide at root
𝑐 𝑙 𝑑 =βˆ’0.2 πœƒ 0,4 βˆ’0.38 πœƒ 1, πœƒ 2, πœƒ 3,4 +𝟎 πœƒ 4,4 𝑐 π‘Ÿ 𝑑 =𝟎 πœƒ 0,4 βˆ’0.15 πœƒ 1,4 βˆ’0.4 πœƒ 2,4 βˆ’0.6 πœƒ 3,4 βˆ’0.2 πœƒ 4,4 𝑐 𝑑 is subdivided at 𝑑 2 . 𝑑 2 𝑑 1 𝑑 2 𝑐 𝑙 (𝑑) 𝑐 π‘Ÿ (𝑑) Center for Graphics and Geometric Computing, Technion

12 Our approach: Factor-out the root
𝑐 𝐿 𝑑 =βˆ’0.2 πœƒ 0,3 βˆ’0.5 πœƒ 1, πœƒ 2, πœƒ 3,4 𝑐 𝑅 𝑑 =βˆ’0.62 πœƒ 0,3 βˆ’0.81 πœƒ 1,3 βˆ’0.8 πœƒ 2,3 βˆ’0.2 πœƒ 3,3 The root at 𝑑 2 is factored out from 𝑐 𝑙 𝑑 and 𝑐 π‘Ÿ 𝑑 . 𝑐 𝑙 (𝑑) 𝑑 1 𝑐 π‘Ÿ (𝑑) 𝑐 𝐿 (𝑑) 𝑐 𝑅 (𝑑) Center for Graphics and Geometric Computing, Technion

13 Center for Graphics and Geometric Computing, Technion
The basic algorithm BZF(𝑐, 𝑑 π‘šπ‘–π‘› , 𝑑 π‘šπ‘Žπ‘₯ ,πœ–,𝛿) if PurgeProblem(𝑐,πœ–) then //Examine if all coefficients are same sign. return βˆ…; end if 𝑑 0 ← NumericStep(𝑐, πœ–, 0.5); //Newton Raphson, starting from 𝑑=0.5. if 𝑑 0 β‰ βˆ… then 𝑐 𝑙 , 𝑐 π‘Ÿ ← Subdivide(𝑐, 𝑑 0 ); 𝑐 𝐿 ← Factor1MinusT( 𝑐 𝑙 ); 𝑐 𝑅 ← FactorT( 𝑐 π‘Ÿ ); return BZF 𝑐 𝐿 , 𝑑 π‘šπ‘–π‘› , 𝑑 0 ,πœ–, 𝛿 βˆͺ { 𝑑 0 }βˆͺ BZF 𝑐 𝑅 , 𝑑 0 , 𝑑 π‘šπ‘Žπ‘₯ ,πœ–, 𝛿 ; else cont’d.. 𝑐 𝐿 (𝑑) 𝑐 𝑅 (𝑑) Center for Graphics and Geometric Computing, Technion

14 The basic algorithm ..cont’d.
else if 𝑑 π‘šπ‘Žπ‘₯ βˆ’ 𝑑 π‘šπ‘–π‘› <𝛿 then return βˆ…; end if 𝑑 0 ← 𝑑 π‘šπ‘Žπ‘₯ + 𝑑 π‘šπ‘–π‘› 2 ; 𝑐 𝑙 , 𝑐 π‘Ÿ ← Subdivide(𝑐, 0.5); return BZF 𝑐 𝑙 , 𝑑 π‘šπ‘–π‘› , 𝑑 0 ,πœ–, 𝛿 βˆͺ BZF( 𝑐 π‘Ÿ , 𝑑 0 , 𝑑 π‘šπ‘Žπ‘₯ ,πœ–, 𝛿); Center for Graphics and Geometric Computing, Technion

15 Counting root multiplicities
Assume root at 𝑑 2 is found. 𝑐(𝑑) 𝑑 1 𝑑 3 𝑑 2 Center for Graphics and Geometric Computing, Technion

16 Counting root multiplicities
𝑐 𝑙 𝑑 =2.12 πœƒ 0,4 βˆ’1.9 πœƒ 1,4 βˆ’0.58 πœƒ 2,4 +𝟎 πœƒ 3,4 +𝟎 πœƒ 4,4 𝑐 π‘Ÿ 𝑑 =𝟎 πœƒ 0,4 +𝟎 πœƒ 1,4 βˆ’0.58 πœƒ 2,4 βˆ’1.59 πœƒ 3, πœƒ 4,4 𝑐 π‘Ÿ (𝑑) 𝑐 𝑙 (𝑑) 𝑐 𝑑 is subdivided at 𝑑 2 . 𝑑 1 𝑑 3 𝑑 2 𝑑 2 Center for Graphics and Geometric Computing, Technion

17 Counting root multiplicities
𝑐 𝐿 𝑑 =2.12 πœƒ 0,3 βˆ’2.54 πœƒ 1,3 βˆ’1.16 πœƒ 2,3 +𝟎 πœƒ 3,3 𝑐 𝑅 𝑑 =𝟎 πœƒ 0,3 βˆ’1.16 πœƒ 1,3 βˆ’2.12 πœƒ 2, πœƒ 3,3 𝑐 𝑅 (𝑑) A root at 𝑑 2 is factored out from 𝑐 𝑙 𝑑 and 𝑐 π‘Ÿ 𝑑 . 𝑐 𝐿 (𝑑) 𝑑 1 𝑑 3 𝑑 2 𝑑 2 Center for Graphics and Geometric Computing, Technion

18 Counting root multiplicities
𝑐 𝐿𝐿 𝑑 =2.12 πœƒ 0,2 βˆ’3.81 πœƒ 1,2 βˆ’3.5 πœƒ 2,2 𝑐 𝑅𝑅 𝑑 =βˆ’3.5 πœƒ 1,3 βˆ’3.18 πœƒ 2, πœƒ 3,3 The second root at 𝑑 2 is factored out from 𝑐 𝐿 𝑑 and 𝑐 𝑅 𝑑 . 𝑐 𝑅𝑅 (𝑑) 𝑐 𝐿𝐿 (𝑑) 𝑑 1 𝑑 3 Center for Graphics and Geometric Computing, Technion

19 Counting root multiplicities
BZF(𝑐, 𝑑 π‘šπ‘–π‘› , 𝑑 π‘šπ‘Žπ‘₯ ,πœ–,𝛿) if PurgeProblem(𝑐,πœ–) then return βˆ…; end if 𝑑 0 ← NumericStep(𝑐, πœ–, 0.5); if 𝑑 0 β‰ βˆ… then 𝑐 𝑙 , 𝑐 π‘Ÿ ← Subdivide(𝑐, 𝑑 0 ); π‘š 0 ←0; do 𝑐 𝑙 ← Factor1MinusT( 𝑐 𝑙 ); 𝑐 π‘Ÿ ← FactorT( 𝑐 π‘Ÿ ); π‘š 0 ← π‘š 0 +1; while | 𝒄 𝒓 𝟎 |<𝝐 return BZF 𝑐 𝑙 , 𝑑 π‘šπ‘–π‘› , 𝑑 0 ,πœ–, 𝛿 βˆͺ { 𝑑 0 }βˆͺ BZF 𝑐 π‘Ÿ , 𝑑 0 , 𝑑 π‘šπ‘Žπ‘₯ ,πœ–, 𝛿 ; Center for Graphics and Geometric Computing, Technion

20 Center for Graphics and Geometric Computing, Technion
More extensions Initialization of Newton-Raphson method Control polygon of a Bezier curve approximates the curve. Use zeros of control polygon as seed for NR method. Center for Graphics and Geometric Computing, Technion

21 Center for Graphics and Geometric Computing, Technion
More extensions Searching for roots outside the domain Allow the NR method to go outside the domain. Factor out the roots found outside the domain. Hence reduce the problem complexity. β†’ Center for Graphics and Geometric Computing, Technion

22 Comparison with previous methods
Analytic: Euler’s method for polynomials of degree up to five. CCI: Intersect the convex-hull of the polynomial with the 𝑑 – axis, [Sederberg and Parry, 1986]. Convex-hulls Bounding-rectangles Source: [Sederberg & Parry, 1986] Center for Graphics and Geometric Computing, Technion

23 Comparison with previous methods
BZF: Our algorithm. NCZ: Use cones bounding the tangent field of the polynomial, [Sederberg and Meyers, 1988]. Non-overlapping wedges Overlapping wedges Source: [Sederberg & Meyers, 1988] Center for Graphics and Geometric Computing, Technion

24 Results I: Random polynomials
Some of the Bezier polynomials with randomly generated coefficients with degrees between 3 and samples for each degree. Center for Graphics and Geometric Computing, Technion

25 Results I: Random polynomials
#CtrlPt Avg #Roots Analytic CCI NCZ BZF BZF-NRI1 BZF-NRI2 4 0.90 0.31 6.11 12.32 1.17 1.09 1.08 5 1.15 0.48 8.83 16.81 1.53 1.35 1.39 6 1.38 - 10.94 20.45 1.90 1.71 1.78 7 1.50 10.66 23.46 2.16 1.88 1.95 8 1.64 14.23 25.55 2.53 2.25 2.33 10 2.04 19.77 33.58 3.49 2.85 3.03 15 26.84 39.88 4.80 4.20 4.24 20 2.82 42.95 58.17 8.03 6.97 7.01 50 167.54 185.63 37.21 31.24 31.31 100 6.74 342.67 225.62 245.25 All times in microseconds, averaged over runs. Center for Graphics and Geometric Computing, Technion

26 Results II: Degree 𝒏 with 𝒏 real roots
Some of the degree 𝑛 polynomials with 𝑛 real roots with 3≀𝑛≀14. One sample per degree. Center for Graphics and Geometric Computing, Technion

27 Results II: Degree 𝒏 with 𝒏 real roots
#CtrlPt #Roots Analytic CCI NCZ BZF BZF-NRI1 BZF-NRI2 4 3 0.48 22.59 36.99 3.83 2.83 2.59 5 0.59 43.62 78.57 4.38 4.15 3.74 6 - 43.56 92.04 6.12 4.96 4.72 7 53.10 114.70 6.18 6.40 6.15 8 72.16 136.48 9.10 7.65 7.28 9 93.52 157.09 8.97 8.82 8.80 10 88.21 201.03 12.18 11.06 10.96 11 113.20 195.19 13.80 11.89 12.56 12 107.83 281.53 13.74 14.42 16.35 13 202.44 382.29 15.98 16.59 16.58 14 158.58 306.96 22.65 18.52 19.77 15 166.22 361.96 24.74 22.00 24.31 All times in microseconds, averaged over runs. Center for Graphics and Geometric Computing, Technion

28 Results III: Repeated roots
Degree 𝑛 polynomials with 𝑛 real roots with one repeated root. 8≀𝑛≀20. One sample per degree. Center for Graphics and Geometric Computing, Technion

29 Results III: Repeated roots
#CtrlPt # Unique Roots Analytic CCI NCZ BZF BZF-NRI1 BZF-NRI2 9 7 - 102.90 169.35 8.16 9.87 9.02 10 8 107.82 214.43 10.89 9.84 9.66 11 125.18 211.18 11.34 12.27 12.54 12 774.45 240.14 12.62 13.03 14.02 13 351.35 285.84 14.61 15.06 15.27 14 319.09 20.84 19.75 20.36 15 764.16 295.76 20.11 19.50 18.36 16 408.83 22.11 23.50 22.71 17 415.89 24.34 24.79 26.46 18 537.87 422.28 27.79 27.20 29.35 19 365.31 505.46 36.66 41.34 33.74 20 553.07 38.18 41.47 33.76 21 622.01 554.67 36.33 46.53 37.95 All times in microseconds, averaged over runs. Center for Graphics and Geometric Computing, Technion

30 Results IV: Wilkinson’s polynomials
Degree 13 Degree 20 #CtrlPt #Roots Analytic CCI NCZ BZF BZF-NRI1 BZF-NRI2 14 13 - 187.66 233.68 14.46 15.79 15.32 21 20 347.11 487.15 40.17 32.89 37.00 All times in microseconds, averaged over runs. Center for Graphics and Geometric Computing, Technion

31 Zeros of B-splines 𝑐(𝑑) Assume the root between consecutive
knots 𝑑 1 and 𝑑 2 is found. 𝑑 1 𝑑 2 Center for Graphics and Geometric Computing, Technion

32 Center for Graphics and Geometric Computing, Technion
Zeros of B-splines 𝑐 𝑙 𝑑 𝑐 π‘Ÿ 𝑑 𝑐 π‘š 𝑑 Subdivide at 𝑑 1 and 𝑑 2 to obtain two B-splines 𝑐 𝑙 𝑑 , 𝑐 π‘Ÿ 𝑑 and a Bezier 𝑐 π‘š 𝑑 . 𝑑 1 𝑑 2 Center for Graphics and Geometric Computing, Technion

33 Results: Zeros of B-splines
Order Length # Avg. Real Roots SubdivAllKnot SelectiveSubdiv 3 4 1.18 0.012 0.011 7 2.76 0.048 0.040 15 6.14 0.148 0.107 25 10.02 0.234 0.186 120 50.99 2.143 1.007 220 93.59 12.304 2.083 0.95 0.010 0.009 2.28 0.035 5.19 0.126 0.101 9.33 0.214 0.181 45.71 1.047 84.57 12.539 2.188 5 2.13 0.033 5.09 0.129 0.106 8.1 0.217 0.185 42.73 2.214 1.114 76.29 13.264 2.279 All times in microseconds, averaged over runs. Center for Graphics and Geometric Computing, Technion

34 Another extension: No subdivision
Guess a root, 𝑑 0 Factor out the root, π‘Ÿ 𝑑 = 𝑐(𝑑) π‘‘βˆ’ 𝑑 0 Recurse, π‘Ÿ 𝑑 Reverse Bezier polynomial multiplication to factor out root Center for Graphics and Geometric Computing, Technion

35 Bezier polynomial multiplication
π‘Ÿ 𝑑 = 𝑖=0 π‘š π‘Ÿ 𝑖 πœƒ 𝑖,π‘š 𝑑 𝑔 𝑑 = 𝑖=0 π‘˜ 𝑔 𝑖 πœƒ 𝑖,π‘˜ 𝑑 𝑐 𝑑 =π‘Ÿ 𝑑 𝑔 𝑑 = 𝑖=0 π‘š+π‘˜ 𝑗= max 0,π‘–βˆ’π‘˜ min π‘š,𝑖 π‘š 𝑗 π‘˜ π‘–βˆ’π‘— π‘š+π‘˜ 𝑖 π‘Ÿ 𝑗 𝑔 π‘–βˆ’π‘— πœƒ 𝑖,π‘š+1 (𝑑) Center for Graphics and Geometric Computing, Technion

36 Center for Graphics and Geometric Computing, Technion
Factoring out root Assume root at 𝑑 0 is known Express polynomial π‘‘βˆ’ 𝑑 0 in Bernstein basis as 𝑔 0 πœƒ 0,1 𝑑 + 𝑔 1 πœƒ 1,1 𝑑 , hence, 𝑐 𝑑 = 𝑖=0 π‘š+1 𝑗= max 0,π‘–βˆ’1 min π‘š,𝑖 π‘š 𝑗 1 π‘–βˆ’π‘— π‘š+1 𝑖 π‘Ÿ 𝑗 𝑔 π‘–βˆ’π‘— πœƒ 𝑖,π‘š+1 (𝑑) 𝑐 𝑑 = π‘Ÿ 0 𝑔 0 πœƒ 0,π‘š+1 𝑑 + 𝑖=1 π‘š π‘š π‘–βˆ’1 π‘š+1 𝑖 π‘Ÿ π‘–βˆ’1 𝑔 π‘š 𝑖 π‘š+1 𝑖 π‘Ÿ 𝑖 𝑔 0 πœƒ 𝑖,π‘š+1 (𝑑) + π‘Ÿ π‘š 𝑔 1 πœƒ π‘š+1,π‘š+1 𝑑 Center for Graphics and Geometric Computing, Technion

37 Center for Graphics and Geometric Computing, Technion
Factoring out root π‘Ÿ 𝑖 = 𝑐 0 𝑔 0 , 𝑖=0, 𝑐 𝑖 π‘š+1 𝑖 βˆ’ π‘Ÿ π‘–βˆ’1 𝑔 1 π‘š π‘–βˆ’1 π‘š 𝑖 𝑔 0 , 1β‰€π‘–β‰€π‘š. π‘Ÿ 𝑖 = 𝑐 π‘š+1 𝑔 1 , 𝑖=π‘š, 𝑐 𝑖+1 π‘š+1 𝑖+1 βˆ’ π‘Ÿ 𝑖+1 𝑔 0 π‘š 𝑖 π‘š 𝑖 𝑔 1 , π‘šβˆ’1β‰₯𝑖β‰₯0. Center for Graphics and Geometric Computing, Technion

38 Another extension: No subdivision
Assume the root at 𝑑 1 is known. 𝑑 1 𝑑 2 𝑐(𝑑) Center for Graphics and Geometric Computing, Technion

39 Another extension: No subdivision
After factoring out the root at 𝑑 1 . 𝑑 2 π‘ž(𝑑) Center for Graphics and Geometric Computing, Technion

40 Results All times in microseconds, averaged over 10000 runs. #CtrlPt
#Roots CagdCrvZeroSet ZerosNoSubdiv 3 2 1.94 1.21 4 3.03 1.72 5 4.01 2.69 6 5.09 3.52 7 6.51 6.33 8 8.27 5.82 9 9.55 8.99 10 12.01 9.05 All times in microseconds, averaged over runs. Center for Graphics and Geometric Computing, Technion

41 Results All times in microseconds, averaged over 10000 runs. #CtrlPt
#Roots CagdCrvZeroSet ZerosNoSubdiv 3 0.78 0.99 0.70 4 0.89 1.41 1.03 5 1.14 1.51 1.39 6 1.37 1.81 1.87 7 1.38 1.96 2.17 8 1.62 2.56 2.70 10 1.84 2.98 3.54 15 2.29 4.89 6.81 20 2.83 8.20 12.77 All times in microseconds, averaged over runs. Center for Graphics and Geometric Computing, Technion

42 Center for Graphics and Geometric Computing, Technion
Future directions Handling numerical instabilities while detecting higher-order multiplicities. Inspect first π‘˜ coefficients for detecting a multiplicity of order π‘˜. Extension to finding zeros of multi-variates. Extension to finding solution of CCI and SSI. Center for Graphics and Geometric Computing, Technion

43 Center for Graphics and Geometric Computing, Technion
Thank You! Center for Graphics and Geometric Computing, Technion


Download ppt "Efficient Methods for Roots of Univariate Scalar Beziers"

Similar presentations


Ads by Google