2D Spline Curves

2D Spline Curves

2D Spline Curves CS 4620 Lecture 18 Cornell CS4620 Fall 2013 • Lecture 16 © 2013 Steve Marschner • 1 Motivation: smoothness • In many applications we need smooth shapes – that is, without discontinuities [Boeing] • So far we can make – things with corners (lines, triangles, squares, rectangles, …) – circles, ellipses, other special shapes (only get you so far!) Cornell CS4620 Fall 2013 • Lecture 16 © 2013 Steve Marschner • 2 Classical approach • Pencil-and-paper draftsmen also needed smooth curves • Origin of “spline:” strip of flexible metal – held in place by pegs or weights to constrain shape – traced to produce smooth contour Cornell CS4620 Fall 2013 • Lecture 16 © 2013 Steve Marschner • 3 Translating into usable math • Smoothness – in drafting spline, comes from physical curvature minimization – in CG spline, comes from choosing smooth functions • usually low-order polynomials • Control – in drafting spline, comes from fixed pegs – in CG spline, comes from user-specified control points Cornell CS4620 Fall 2013 • Lecture 16 © 2013 Steve Marschner • 4 Defining spline curves • At the most general they are parametric curves S = f(t) t [0,N] { | 2 } • For splines, f(t) is piecewise polynomial – for this lecture, the discontinuities are at the integers Cornell CS4620 Fall 2013 • Lecture 16 © 2013 Steve Marschner • 5 Defining spline curves • At the most general they are parametric curves S = f(t) t [0,N] { | 2 } • For splines, f(t) is piecewise polynomial – for this lecture, the discontinuities are at the integers Cornell CS4620 Fall 2013 • Lecture 16 © 2013 Steve Marschner • 5 Defining spline curves • At the most general they are parametric curves S = f(t) t [0,N] { | 2 } • For splines, f(t) is piecewise polynomial – for this lecture, the discontinuities are at the integers Cornell CS4620 Fall 2013 • Lecture 16 © 2013 Steve Marschner • 5 Defining spline curves • At the most general they are parametric curves S = f(t) t [0,N] { | 2 } • For splines, f(t) is piecewise polynomial – for this lecture, the discontinuities are at the integers Cornell CS4620 Fall 2013 • Lecture 16 © 2013 Steve Marschner • 5 Defining spline curves • Generally f(t) is a piecewise polynomial – for this lecture, the discontinuities are at the integers – e.g., a cubic spline has the following form over [k, k + 1]: – Coefficients are different for every interval Cornell CS4620 Fall 2013 • Lecture 16 © 2013 Steve Marschner • 6 Coordinate functions Cornell CS4620 Fall 2013 • Lecture 16 © 2013 Steve Marschner • 7 Coordinate functions Cornell CS4620 Fall 2013 • Lecture 16 © 2013 Steve Marschner • 7 Coordinate functions Cornell CS4620 Fall 2013 • Lecture 16 © 2013 Steve Marschner • 7 Coordinate functions Cornell CS4620 Fall 2013 • Lecture 16 © 2013 Steve Marschner • 7 Coordinate functions Cornell CS4620 Fall 2013 • Lecture 16 © 2013 Steve Marschner • 8 Coordinate functions Cornell CS4620 Fall 2013 • Lecture 16 © 2013 Steve Marschner • 8 Coordinate functions Cornell CS4620 Fall 2013 • Lecture 16 © 2013 Steve Marschner • 8 Coordinate functions Cornell CS4620 Fall 2013 • Lecture 16 © 2013 Steve Marschner • 8 Coordinate functions Cornell CS4620 Fall 2013 • Lecture 16 © 2013 Steve Marschner • 8 Control of spline curves • Specified by a sequence of controls (points or vectors) • Shape is guided by control points (aka control polygon) – interpolating: passes through points – approximating: merely guided by points Cornell CS4620 Fall 2013 • Lecture 16 © 2013 Steve Marschner • 9 Control of spline curves • Specified by a sequence of controls (points or vectors) • Shape is guided by control points (aka control polygon) – interpolating: passes through points – approximating: merely guided by points Cornell CS4620 Fall 2013 • Lecture 16 © 2013 Steve Marschner • 9 Control of spline curves • Specified by a sequence of controls (points or vectors) • Shape is guided by control points (aka control polygon) – interpolating: passes through points – approximating: merely guided by points Cornell CS4620 Fall 2013 • Lecture 16 © 2013 Steve Marschner • 9 Control of spline curves • Specified by a sequence of controls (points or vectors) • Shape is guided by control points (aka control polygon) – interpolating: passes through points – approximating: merely guided by points Cornell CS4620 Fall 2013 • Lecture 16 © 2013 Steve Marschner • 9 How splines depend on their controls • Each coordinate is separate – the function x(t) is determined solely by the x coordinates of the control points – this means 1D, 2D, 3D, … curves are all really the same • Spline curves are linear functions of their controls – moving a control point two inches to the right moves x(t) twice as far as moving it by one inch – x(t), for fixed t, is a linear combination (weighted sum) of the controls’ x coordinates – f(t), for fixed t, is a linear combination (weighted sum) of the controls Cornell CS4620 Fall 2013 • Lecture 16 © 2013 Steve Marschner • 10 Plan 1. Spline segments – how to define a polynomial on [0,1] – …that has the properties you want – …and is easy to control 2. Spline curves – how to chain together lots of segments – …so that the whole curve has the properties you want – …and is easy to control 3. Refinement and evaluation – how to add detail to splines – how to approximate them with line segments Cornell CS4620 Fall 2013 • Lecture 16 © 2013 Steve Marschner • 11 Spline Segments Cornell CS4620 Fall 2013 • Lecture 16 © 2013 Steve Marschner • 12 Trivial example: piecewise linear • This spline is just a polygon – control points are the vertices • But we can derive it anyway as an illustration • Each interval will be a linear function – x(t) = at + b – constraints are values at endpoints – b = x0 ; a = x1 – x0 – this is linear interpolation Cornell CS4620 Fall 2013 • Lecture 16 © 2013 Steve Marschner • 13 Trivial example: piecewise linear • Vector formulation x(t)=(x x )t + x 1 − 0 0 y(t)=(y y )t + y 1 − 0 0 f(t)=(p p )t + p 1 − 0 0 • Matrix formulation 11 p f(t)= t 1 0 −10p 1 ⇥ ⇤ Cornell CS4620 Fall 2013 • Lecture 16 © 2013 Steve Marschner • 14 Trivial example: piecewise linear • Basis function formulation – regroup expression by p rather than t f(t)=(p p )t + p 1 − 0 0 =(1 t)p + tp − 0 1 – interpretation in matrix viewpoint 11 p f(t)= t 1 0 −10 p ✓ ◆ 1 ⇥ ⇤ Cornell CS4620 Fall 2013 • Lecture 16 © 2013 Steve Marschner • 15 Trivial example: piecewise linear • Vector blending formulation: “average of points” – blending functions: contribution of each point as t changes Cornell CS4620 Fall 2013 • Lecture 16 © 2013 Steve Marschner • 16 Hermite splines • Less trivial example • Form of curve: piecewise cubic • Constraints: endpoints and tangents (derivatives) t0 p0 p1 t1 Cornell CS4620 Fall 2013 • Lecture 16 © 2013 Steve Marschner • 17 Hermite splines • Solve constraints to find coefficients x(t)=at3 + bt2 + ct + d 2 x0(t)=3at +2bt + c d = x0 x(0) = x0 = d c = x0 x(1) = x1 = a + b + c + d a =2x 2x + x0 + x0 0 − 1 0 1 x0(0) = x0 = c b = 3x +3x 2x0 x0 0 − 0 1 − 0 − 1 x0(1) = x10 =3a +2b + c Cornell CS4620 Fall 2013 • Lecture 16 © 2013 Steve Marschner • 18 Matrix form of spline f(t)=at3 + bt2 + ct + d p0 ⇥⇥⇥⇥ p t3 t2 t 1 1 2⇥⇥⇥⇥3 2p 3 ⇥⇥⇥⇥ 2 ⇥ ⇤ 6 7 6p37 6⇥⇥⇥⇥7 6 7 4 5 4 5 f(t)=b0(t)p0 + b1(t)p1 + b2(t)p2 + b3(t)p3 Cornell CS4620 Fall 2013 • Lecture 16 © 2013 Steve Marschner • 19 Matrix form of spline f(t)=at3 + bt2 + ct + d p0 ⇥⇥⇥⇥ p t3 t2 t 1 1 2⇥⇥⇥⇥3 2p 3 ⇥⇥⇥⇥ 2 ⇥ ⇤ 6 7 6p37 6⇥⇥⇥⇥7 6 7 4 5 4 5 f(t)=b0(t)p0 + b1(t)p1 + b2(t)p2 + b3(t)p3 Cornell CS4620 Fall 2013 • Lecture 16 © 2013 Steve Marschner • 19 Matrix form of spline f(t)=at3 + bt2 + ct + d p0 ⇥⇥⇥⇥ p t3 t2 t 1 1 2⇥⇥⇥⇥3 2p 3 ⇥⇥⇥⇥ 2 ⇥ ⇤ 6 7 6p37 6⇥⇥⇥⇥7 6 7 4 5 4 5 f(t)=b0(t)p0 + b1(t)p1 + b2(t)p2 + b3(t)p3 Cornell CS4620 Fall 2013 • Lecture 16 © 2013 Steve Marschner • 19 Hermite splines • Matrix form is much simpler 2 21 1 p0 33− 2 1 p f(t)= t3 t2 t 1 2− − − 3 2 13 0010 t0 ⇥ ⇤ 6 10007 6t1 7 6 7 6 7 4 5 4 5 – coefficients = rows – basis functions = columns • note p columns sum to [0 0 0 1]T Cornell CS4620 Fall 2013 • Lecture 16 © 2013 Steve Marschner • 20 Hermite splines • Hermite blending functions Cornell CS4620 Fall 2013 • Lecture 16 © 2013 Steve Marschner • 21 Hermite to Bézier • Mixture of points and vectors is awkward • Specify tangents as differences of points t 0 p0 p1 t1 Cornell CS4620 Fall 2013 • Lecture 16 © 2013 Steve Marschner • 22 Hermite to Bézier • Mixture of points and vectors is awkward • Specify tangents as differences of points t 0 – t1 p0 p1 Cornell CS4620 Fall 2013 • Lecture 16 © 2013 Steve Marschner • 22 Hermite to Bézier • Mixture of points and vectors is awkward • Specify tangents as differences of points t 0 – t1 p0 p1 Cornell CS4620 Fall 2013 • Lecture 16 © 2013 Steve Marschner • 22 Hermite to Bézier • Mixture of points and vectors is awkward • Specify tangents as differences of points q 1 q 2 I’m calling these t 0 points q just for – t this slide and the 1 next one. p0 q0 q 3 p1 – note derivative is defined as 3 times offset • reason is illustrated by linear case Cornell CS4620 Fall 2013 • Lecture 16 © 2013 Steve Marschner • 22 Hermite to Bézier q1 q2 t p0 = q0 0 – t p1 = q3 1 p0 q t0 = 3(q1 q0) 0 q p − 3 1 t = 3(q q ) 1 3 − 2 p0 1000q0 p 0001q 1 = 1 2v 3 2 33 0 03 2q 3 0 − 2 6v 7 6 00 337 6q 7 6 17 6 − 7 6 37 4 5 4 5 4 5 Cornell CS4620 Fall 2013 • Lecture 16 © 2013 Steve Marschner • 23 Hermite to Bézier q1 q2 t p0 = q0 0 – t p1 = q3 1 p0 q t0 = 3(q1 q0) 0 q p − 3 1 t = 3(q q ) 1 3 − 2 a 2 21 1 1000q0 b 33− 2 1 0001q = 1 2c3 2−0010− − 3 2 33 0 03 2q 3 − 2 6d7 6 10007 6 00 337 6q 7 6 7 6 7 6 − 7 6 37 4 5 4 5 4 5 4 5 Cornell CS4620 Fall 2013 • Lecture

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    108 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us