Presentation is loading. Please wait.

Presentation is loading. Please wait.

Splines IV – B-spline Curves based on: Michael Gleicher: Curves, chapter 15 in Fundamentals of Computer Graphics, 3 rd ed. (Shirley & Marschner) Slides.

Similar presentations


Presentation on theme: "Splines IV – B-spline Curves based on: Michael Gleicher: Curves, chapter 15 in Fundamentals of Computer Graphics, 3 rd ed. (Shirley & Marschner) Slides."— Presentation transcript:

1 Splines IV – B-spline Curves based on: Michael Gleicher: Curves, chapter 15 in Fundamentals of Computer Graphics, 3 rd ed. (Shirley & Marschner) Slides by Marc van Kreveld 1

2 Interpolation vs. approximation Interpolation means passing through given points, approximation means getting “close” to given points Bézier curves and B-spline curves p3p3 p2p2 p1p1 p0p0 p3p3 p2p2 p1p1 p0p0 p 1 and p 2 are interpolated p 1 and p 2 are approximated 2

3 B-spline curves Approximates all control points Polynomials of any degree d C d-1 continuous everywhere 3

4 B-spline curves A linear combination of the control points The b i (t) are the basis functions and show how to blend the points The basis functions are splines themselves  B-splines t bi(t)bi(t) the contribution of point p i to the curve depending on the parameter value t 4

5 B-splines and B-spline curves t bi(t)bi(t) b i-1 (t)b i+1 (t) p i-1 pipi p i+1 t’ 0.15 0.55 0.3 5

6 B-splines and B-spline curves bi(t)bi(t) b i-1 (t)b i+1 (t) p i-1 pipi p i+1 t’ b i (t’)=0.55 b i-1 (t’)=0.15 b i+1 (t’)=0.3 0.15 0.55 0.3 t 6

7 B-splines and B-spline curves bi(t)bi(t) b i-1 (t)b i+1 (t) p i-1 pipi p i+1 t’ 0.15 0.55 0.3 t the blended point determined by p i-1, p i, p i+1 and their basis functions 7

8 B-spline curves 8 A B-spline curve of n points and parameter value k – is C k-2 continuous – is made of polynomials of degree k – 1 – has local control: any location on the curve is determined by only k control points – is bounded by the convex hull of the control points – has the variation diminishing property: any line intersects the B-spline curve at most as often as that line intersects the control polygon

9 Types of B-splines Uniform linear B-splines Uniform quadratic B-splines Uniform cubic B-splines Non-uniform B-splines NURBS (non-uniform rational B-splines)  To define the B-splines is to define the B-spline curve 9

10 Uniform linear B-splines Basis functions are piecewise linear, for example: b 1,2 (t) 1 54321 i  t  i+1 i +1  t  i +2 otherwise knots 10

11 Uniform linear B-splines, knots A knot (for a uniform linear B-spline, or any type of B-spline) is a parameter value where the definition of the function of some B-spline changes Slight abuse: the corresponding point on the curve b 1,2 (t) 1 54321 knots 11

12 Uniform linear B-splines, knots b 1,2 (t) b 2,2 (t) 1 54321 1 54321 b 3,2 (t) 1 54321 12 five knots in total

13 Uniform linear B-splines Basis functions are piecewise linear, for example: The B-spline curve can be used for parameter values t  [2, n+1] (the t where the b i,2 (t) sum up to 1), given points p 1, p 2, …, p n The B-spline curve is just the polygonal line through the control points; only two B-splines are non-zero for any t i  t  i +1 i +1  t  i +2 otherwise 13

14 Uniform linear B-splines Each B-spline has 3 knots and they are uniformly spaced  They are shifted copies of each other In total there are n+2 knots (at 1, 2, …, n+2) b 1,2 (t) b 2,2 (t) 1 54321 1 54321 b 3,2 (t) 1 54321 14

15 Uniform quadratic B-splines Uniform quadratic B-splines b i,3 (t) have knots at i, i+1, i+2, and i+3 They are shifted copies of each other t b 1,3 (t) 54321 1 15

16 Uniform quadratic B-splines t b 1,3 (t) 54321 1 if t  [i, i+1] u = t – i if t  [i+1, i+2] u = t – (i+1) if t  [i+2, i+3] u = t – (i+2) otherwise 0.5 u is set to be in [0,1] for the t-range 16

17 Quadratic B-spline curve p1p1 p6p6 p2p2 p5p5 p4p4 p3p3 p7p7 control points defining this piece of curve between the knots p2p3p4p2p3p4 p1p2p3p1p2p3 p3p4p5p3p4p5 p4p5p6p4p5p6 p5p6p7p5p6p7 knot 17

18 Uniform quadratic B-splines At the 4 knots, the left and right derivatives are equal  C 1 continuous B-splines  C 1 continuous B-spline curve t 54321 1 0.5 b 2,3 (t) b’ 2,3 (t) (derivative) – 1 – 0.5 18

19 Uniform quadratic B-splines At the 4 knots, the left and right derivatives are equal  C 1 continuous B-splines  C 1 continuous B-spline curve Starting at t = 3, the B-splines sum up to exactly 1 t 54321 1 0.5 b 1,3 (t) b 2,3 (t)b 3,3 (t)b 4,3 (t)b 5,3 (t) 19

20 Uniform quadratic B-splines Suppose n control points Then we have n B-splines and n+3 knots The B-spline curve has n – 2 quadratic pieces, starting at the 3 rd knot and ending at the n+1 st knot 20

21 Uniform quadratic B-splines What is the starting point and what is the ending point of the uniform quadratic B-spline curve using control points p 1, p 2, …, p n ? 21

22 Uniform cubic B-splines Uniform cubic B-splines b i,4 (t) have knots at i, i+1, i+2, i+3 and i+4 They are shifted copies of each other t b 1,4 (t) 54321 1 0.5 6 2/3 22

23 Uniform cubic B-splines if t  [i, i+1] u = t – i if t  [i+1, i+2] u = t – (i+1) if t  [i+2, i+3] u = t – (i+2) otherwise if t  [i+3, i+4] u = t – (i+3) t b 1,4 (t) 54321 1 0.5 6 2/3 23

24 Uniform cubic B-splines Every location on the B-spline curve is determined by four control points and their B-splines Starting at the 4 th knot, t = 4, the B-spline curve can be used, because the B-splines sum up to 1 A cubic B-spline is C 2 continuous (the 1 st and 2 nd derivatives from the left and right are the same at the knots, and everywhere else too of course)  a cubic B-spline curve is C 2 continuous 24

25 Uniform cubic B-splines At what height are the second and fourth knots of a cubic B-spline? What weight of what control points determines the first point of a B-spline curve? 25 b 1,4 (t) 54321 1 0.5 6 2/3 7 8 b 2,4 (t) b 3,4 (t) b 4,4 (t) t 54321 1 0.5 6 2/3

26 Closed uniform B-spline curves Simply repeat the first k – 1 points as the last points – quadratic: p 1, p 2, …, p n  p 1, p 2, …, p n, p 1, p 2 – cubic: p 1, p 2, p 3, …, p n  p 1, p 2, …, p n, p 1, p 2, p 3 26

27 Non-uniform B-splines Uniform B-splines have knots at 1, 2, 3, …, but generally knots can have any parameter value  non-uniform B-splines The knot vector t = [t 1, …, t n+k ] is a sequence of non- decreasing values specifying where the knots for the parameter t occur 27

28 Non-uniform B-splines We can repeat control points and combine the consecutive B-splines into one  allows more local control We can repeat knots and adapt the B-splines affected  allows more local control When we have a sequence of control points and a useful parameter range k,..., n+1, we may want to insert an extra point (and knot) in the middle without changing the parameter range near the ends 28

29 Cox-de Boor recurrence if t i  t < t i+1 otherwise Cox-de Boor recurrence for defining B-splines with parameter k and knot vector t = [t 1, …, t n+k ]: 29 The recurrence shows that parameter k B-splines are a weighted interpolation of parameter k – 1 B-splines, with weights linearly dependent on t

30 Repeating control points in B-spline curves Consider quadratic B-spline curves, in the figure: – Five B-splines of control points – 5+3 = 8 knots (t = 1, 2,..., 8), useful in interval [3, 6] t 54321 1 0.5 b 1,3 (t) b 2,3 (t)b 3,3 (t)b 4,3 (t)b 5,3 (t) 7 68 p1p1 p2p2 p3p3 p4p4 p5p5 30

31 Repeating control points in B-spline curves Consider quadratic B-spline curves, in the figure: – Suppose p 1 is repeated – 9 knots, useful interval [3, 7] t 54321 1 0.5 b 1,3 (t) b 2,3 (t)b 3,3 (t)b 4,3 (t)b 5,3 (t) 7 68 p1p1 p2p2 p3p3 p4p4 p5p5 9 b* 1,3 (t) p1p1 31

32 Repeating control points in B-spline curves Consider quadratic B-spline curves, in the figure: – Suppose p 1 is repeated – 9 knots, useful interval [3, 7] – The B-spline curve starts at p 1 at knot 3 t 54321 1 0.5 b 2,3 (t)b 3,3 (t)b 4,3 (t)b 5,3 (t) 7 68 p1p1 p2p2 p3p3 p4p4 p5p5 9 b 1,3 (t)b* 1,3 (t)+ 32

33 Repeating control points in B-spline curves Consider quadratic B-spline curves, in the figure: – Suppose p 3 is repeated – 9 knots, useful interval [3, 7] t 54321 1 0.5 b 1,3 (t) b 2,3 (t) b 3,3 (t) b 4,3 (t)b 5,3 (t) 7 68 p1p1 p2p2 p3p3 p4p4 p5p5 9 b* 3,3 (t) p3p3 33

34 Repeating control points in B-spline curves Consider quadratic B-spline curves, in the figure: – Suppose p 3 is repeated – 9 knots, useful interval [3, 7] – The B-spline curve passes through point p 3 t 54321 1 0.5 b 1,3 (t) b 2,3 (t) b 3,3 (t) b 4,3 (t)b 5,3 (t) 7 68 p1p1 p2p2 p4p4 p5p5 9 b* 3,3 (t) p3p3 + 34

35 Repeating control points in B-spline curves For a B-spline curve with parameter k (degree k – 1), it will pass through the first and last control points if each occurs k – 1 times Similarly, we can make it pass through an intermediate control point by having k – 1 copies of that control point The level of geometric continuity, G, at an intermediate repeated control point decreases 35

36 Repeating control points in B-spline curves On the parameter interval [4,5], only p 2 and p 3 have a non-zero B-spline  the curve is a line segment! Also on parameter interval [5,6] t 54321 1 0.5 b 1,3 (t) b 2,3 (t) b 3,3 (t) b 4,3 (t)b 5,3 (t) 7 68 p1p1 p2p2 p4p4 p5p5 9 b* 3,3 (t) p3p3 + 36

37 Repeating control points in B-spline curves p1p1 p6p6 p2p2 p5p5 p3p3 p7p7 quadratic B-spline curve p1p2p3p1p2p3 p3p4p5p3p4p5 p5p6p7p5p6p7 knot 3 37 p2p3p4p2p3p4 p4p5p6p4p5p6 p4p4

38 Repeating control points in B-spline curves p1p1 p6p6 p2p2 p5p5 p4p4 p3p3 p7p7 quadratic B-spline curve with repeated control point p2p3p4p2p3p4 p1p2p3p1p2p3 p3p4p3p4 p4p5p6p4p5p6 p5p6p7p5p6p7 knot 3 repeated control point p 4 38 p4p5p4p5

39 Repeating control points in B-spline curves The quadratic B-spline curve remains C 1 although it is only G 0 at the repeated control point t 54321 1 0.5 b 1,3 (t) b 2,3 (t) b 3,3 (t) b 4,3 (t)b 5,3 (t) 7 68 p1p1 p2p2 p4p4 p5p5 9 b* 3,3 (t) p3p3 + 39

40 Repeating control points in B-spline curves p1p1 p6p6 p2p2 p5p5 p4p4 p3p3 p7p7 quadratic B-spline curve with repeated control point p2p3p4p2p3p4 p1p2p3p1p2p3 p3p4p3p4 p4p5p6p4p5p6 p5p6p7p5p6p7 knot 3 repeated control point p 4 40 p4p5p4p5

41 Repeating knots in B-spline curves Repeating a knot means that one sequence of control points no longer occurs – For example, for quadratic B-spline curves, the part between knots 4 and 5 (was based on points p 2 p 3 p 4 ) – The curve part before (based on points p 1 p 2 p 3 ) directly connects to the curve part after (based on points p 3 p 4 p 5 ) – The B-splines get different shapes to accommodate the missing part (because the B-splines must still be continuous and sum up to 1) 41

42 Repeating knots in B-spline curves Repeating a knot means that one sequence of control points no longer occurs – For example, for quadratic B-spline curves, the part between knots 4 and 5 (was based on points p 2 p 3 p 4 ) t 54321 1 0.5 b 1,3 (t) b 2,3 (t)b 3,3 (t)b 4,3 (t)b 5,3 (t) 7 68 42

43 Repeating knots in B-spline curves Repeating a knot means that one sequence of control points no longer occurs – For example, for quadratic B-spline curves, the part between knots 4 and 5 (was based on points p 2 p 3 p 4 ) t 54321 1 0.5 b 1,3 (t) b 2,3 (t) b 3,3 (t) b 4,3 (t)b 5,3 (t) 7 68 = 43

44 Repeating knots in B-spline curves Repeating a knot means that one sequence of control points no longer occurs – For example, for quadratic B-spline curves, the part between knots 4 and 5 (was based on points p 2 p 3 p 4 ) t 54 321 1 0.5 b 1,3 (t) b 2,3 (t) b 3,3 (t) b 4,3 (t) b 5,3 (t) 7 68 44

45 Repeating knots in B-spline curves p1p1 p6p6 p2p2 p5p5 p4p4 p3p3 p7p7 quadratic B-spline curve p2p3p4p2p3p4 p1p2p3p1p2p3 p3p4p5p3p4p5 p4p5p6p4p5p6 p5p6p7p5p6p7 knot 3 repeat knot 5 45

46 Repeating knots in B-spline curves p1p1 p6p6 p2p2 p5p5 p4p4 p3p3 p7p7 quadratic B-spline curve with repeated knot p2p3p4p2p3p4 p1p2p3p1p2p3 p4p5p6p4p5p6 p5p6p7p5p6p7 knot 3 knot 5 = 6 46

47 Repeating knots in B-spline curves Repeating a control point creates line segments on either side, but repeating a knot does not have this effect on quadratic B-spline curves Repeating a knot twice (three same knots in a sequence) creates a discontinuity in a quadratic B-spline curve – Two consecutive curve parts have no point in common – The curve part before the two disappearing parts (e.g., based on points p 1 p 2 p 3 ) is disconnected from the curve part after those parts (based on points p 4 p 5 p 6 ) 47

48 Repeating knots in B-spline curves p1p1 p6p6 p2p2 p5p5 p4p4 p3p3 p7p7 quadratic B-spline curve p2p3p4p2p3p4 p1p2p3p1p2p3 p3p4p5p3p4p5 p4p5p6p4p5p6 p5p6p7p5p6p7 knot 3 repeat knot 5 twice 48

49 Repeating knots in B-spline curves p1p1 p6p6 p2p2 p5p5 p4p4 p3p3 p7p7 quadratic B-spline curve p2p3p4p2p3p4 p1p2p3p1p2p3 p5p6p7p5p6p7 knot 3 knot 5 = 6 = 7 49

50 Repeating knots in B-spline curves In cubic B-spline curves – a double knot gives C 1 / G 1 continuity – a triple knot gives C 0 / G 0 continuity – a quadruple knot disconnects the curve – a triple knot at the start lets p 1 be the start of the curve – a triple knot at the end lets p n be the end of the curve 50

51 Repeating knots in B-spline curves Cubic B-splines for a B-spline curve passing through its endpoints, knot vector [1, 1, 1, 2, 3, 4, 5, 6, 7, 8, 8, 8] The first three and last three B-splines are different from the standard cubic B-spline shape 51

52 Repeating knots in B-spline curves The expressions for B-splines can be determined for any parameter k and knot vector t = [t 1, …, t n+k ] using the Cox-de Boor recurrence (also when knots are repeated): 52 if t i  t < t i+1 otherwise These recurrences also allow easy evaluation: get the point on a B-spline curve for a given t

53 Summary B-spline curves are defined by B-splines and provide great flexibility in curve design They exist of any order (degree) and continuity Repeating control points or knots allows interpolation instead of approximation B-spline surfaces are a direct generalization Even more general are NURBS: Non-Uniform Rational B-Splines – defined using ratios of two polynomials – allow conic sections (circles, ellipses, hyperbolas) 53

54 Questions 1.Let p 1 p 2 p 3 be the three points of a uniform linear B-spline curve, so there are five knots 1, 2, 3, 4 and 5. The useful parameter range is from knot 2 to knot 4. Draw the curve from knot 1 to knot 5, so also outside the useful parameter range, where p 1 = (1,2), p 2 = (3,1), and p 3 = (2,1) 2.Approximately draw a quadratic B-spline curve for the points (1,2), (4,2), (4,0), (6,3), and (4,4) in its useful para- meter range. Make sure the curve is correct at its knots 3.Same but now for a cubic B-spline curve 4.Draw a cubic B-spline and its derivative in one figure, as was done for quadratic B-splines in the slides 5.Suppose a quadratic B-spline curve is based on 8 points. Point 4 is repeated and so is point 6. How many polygonal pieces does the B-spline curve have? 54


Download ppt "Splines IV – B-spline Curves based on: Michael Gleicher: Curves, chapter 15 in Fundamentals of Computer Graphics, 3 rd ed. (Shirley & Marschner) Slides."

Similar presentations


Ads by Google