Prof. P. Koumoutsakos Prof. Dr. Jens Walther ETH Zentrum, CLT F 1, E 11 CH-809 Zürich Models, Algorithms and Data (MAD): Introduction to Computing Spring semester 018 Set 5, Total points: 100 Issued: week of 6.03.018 Question 1: Construct B-splines [30 points] The B-splines are constructed recursively as: { 1 if t i x < t i+1, B i,0,t (x) = 0 otherwise, B i,d,t (x) = x t i B i,d 1,t (x) + t i+d+1 x B i+1,d 1,t (x). t i+d t i t i+d+1 t i+1 a) [10 points] For d=1, M=4, and the knot vector t= { 0, 0., 0.4, 0.6, 0.8, 1 }. The zero degree B-spline is non-zero only in the following intervals 1, 0 x < 0. (i ) 1, 0. x < 0.4 (i = ) B i,0 (x), 0.4 x < 0.6 (i = 3) 1, 0.6 x < 0.8 (i = 4) 1. 0.8 x < 1 (i = 5) Here the index t in the B-splines is dropped for simplicity. For the B-splines with d=1, the first two of them are B 1,1 (x) = x 0 0. 0 B 1,0(x) + 0.4 x 5x, 0 x < 0. 0.4 0. B,0(x) = 5x, 0. x < 0.4 0, otherwise B,1 (x) = x 0. 0.4 0. B,0(x) + 0.6 x 0.6 0.4 B 3,0(x) = These two B-splines are shown in Fig. 1. 5x 1, 0. x < 0.4 3 5x, 0.4 x < 0.6 0. otherwise (1) () (3) (4) 1
Figure 1: First two B-splines with d=1 in Question 1. b) [10 points] Using the same knot vector and results in a), the first () B-splines with d= can be constructed as B 1, (x) = x 0 0.4 0 B 1,1(x) + 0.6 x 0.6 0. B,1(x) 5x/ 5x, 0 x < 0. 5x/ ( 5x) + (3/ 5x/) (5x 1), 0. x < 0.4 = (3/ 5x/) (3 5x), 0.4 x < 0.6 0, otherwise (5) 5x /, 0 x < 0. 5x + 15x 3/, 0. x < 0.4 = 5x / 15x + 9/, 0.4 x < 0.6 0. otherwise This piecewise parabolic function is plotted in Fig.. c) [10 points] Then the first derivative of B 1, (x) is 5x, 0 x < 0. B 1,(x) 50x + 15, 0. x < 0.4 = 5x 15, 0.4 x < 0.6 0, otherwise We can further verify that at each knot vector, we have 5, x = 0. B 1,(x) L = B 1,(x) R = 5, x = 0.4 0, x = 0.6 where B L 1, and B R 1, denotes the first derivative of B 1, (x) on the left and right side of each knot. (6) (7)
Figure : First B-splines with d= in Question 1. As shown in Fig. 1 and Fig., it is obvious that for both d=1 and d=, the B-splines are only non-zero for the range t i x t i+d+1 d) [0 points] We now verify these results online at http://geometrie.foretnik.net/files/nurbsen.swf For B-splines with d=1, we set the degree of the curve to be 1, and the number of control points to be 4. Manually set the knot vector as t= { 0, 0., 0.4, 0.6, 0.8, 1 }, then we can get the piecewise linear functions as shown in Fig. 3. Using the same knot vector, we set the degree of the curve to be, and the number of control points to be 3, for B-splines with d=. We then get the piecewise parabolic functions as shown in Fig. 4. By compare Fig. 1- with Fig. 3-4, we can see that they indeed overlap for the same d. Question : Compute and draw a hidden NURBS spline [70 points] a) [5 points] There are in total four non-trivial intervals: (0, 1 4 ), ( 1 4, 1 ), ( 1, 3 4 ) and ( 3 4, 1). b) [15 points] Using the first equation in (1) we obtain splines B i,0 of degree 0 (with notation for knot vector t dropped from B i,d,t ) on the interval (0, 1): B 1,0 (x) = B,0 (x) = B 4,0 (x) = B 5,0 (x) = 0, B 3,0 (x). (8) Now, using the second (recursion) equation in (1) we obtain splines B i,1 of degree 1 from splines B i,0 of degree 0 (using convention 0/0 = 0): B 1,1 (x) = 0, B,1 (x) = t 4 x t 4 t 3 B 3,0 (x) x, B 3,1 (x) = x t 3 t 4 t 3 B 3,0 (x) = x, B 4,1 (x) = 0. (9) 3
Figure 3: B-splines with d=1 in Question 1. Source: geometrie.foretnik.net. Figure 4: B-splines with d= in Question 1. Source: geometrie.foretnik.net. 4
Again, using the second (recursion) equation in (1) we obtain splines B i, of degree from splines B i,1 of degree 1 (using convention 0/0 = 0): B 1, (x) = t 4 x t 4 t B,1 (x) = (1 x), B, (x) = x t t 4 t B,1 (x) + t 5 x t 5 t 3 B 3,1 (x) = x(1 x), B 3, (x) = x t 3 t 5 t 3 B 3,1 (x) = x. (10) The plot of the resulting B-splines in (10) is given in Figure 5. Figure 5: Resulting B-splines B 1, (x), B, (x), B 3, (x) as in (10). Source: geometrie.foretnik.net. c) [0 points] To compute the NURBS curve p(s) = {x(s), y(s)}, defined by (for degree d = and N = 3 control points) p(s) = R i, (s) p i, with R i, (s) = B i, (s)w i 3 j=1 B j,(s)w j, (11) we first compute the sum in the denominator (and denote it by ): = B j, (s)w j = (1 s) + j=1 s(1 s) + s. (1) 5
Now we compute x(s) and y(s) according to (11): and x(s) = R i, (s) p i,1 y(s) = B i, (s) p i,1 w i ( ) (1 s) s(1 s). R i, (s) p i, B i, (s) p i, w i ( ) s(1 s) + s. (13) (14) d) [0 points] As provided by the hint, we firstly compute and x(s) ( (1 s) 4 + (1 s) s(1 s) + s (1 s) ), (15) y(s) ( 4s (1 s) + s(1 s)s + s 4 ). (16) In order to compute, we use the standard square formula (a + b + c) = a + b + c + ab + ac + bc, (17) and notice that is just the sum of the terms in the large brackets in (15) and (16): = ((1 s) 4 + (1 s) ) s(1 s) + s (1 s) + (4s (1 s) + ) (18) s(1 s)s + s 4. Hence, we finally arrive at p(s) = (x(s), y(s) = x(s) + y(s). (19) A curve with norm always equal to 1 is a circle with its center at the origin (0, 0). The graph of this curve is actually only a quarter arc of such circle, as it needs (due to clamping) to begin at control point p 1 and end at control point p 3. For the final result, select Circle 9 points at the bottom left of the application window in geometrie.foretnik.net. The relevant curve is the curve connecting control points p 1, p, p 3, as depicted in Figure 6 - notice, that the figure is generated using geometrie.foretnik.net, where indexing starts from 0 instead of 1 as is the case here and in the lecture notes. 6
Figure 6: Resulting NURBS spline using all 9 control points is a circle of radius 1 centered at origin (0, 0). Source: geometrie.foretnik.net. e) [10 points] The full NURBS spline is just a collection of four such NURBS splines with some rotations and translations. Notice, that due to additional clamping inside knot vector (all interior knots appear twice), the resulting NURBS spline interpolates (passes through) control points p 1, p 3, p 5, p 7, p 9. For the final result, select Circle 9 points at the bottom left of the application window in geometrie.foretnik.net. You will obtain the output that is depicted in Figure 6. Since all odd control points p 1, p 3, p 5, p 7, p 9 are clamped, for the odd internal points ( p 3, p 5, p 7 ), the change affects two quarter-arcs that are connected using the modified control point. For the other points ( even and end control points), the modification would only affect its own quarter-arc. 7