reading
play

Reading CPSC 314 Computer Graphics FCG Chap 15 Curves Jan-Apr 2013 - PowerPoint PPT Presentation

University of British Columbia Reading CPSC 314 Computer Graphics FCG Chap 15 Curves Jan-Apr 2013 Ch 13 2nd edition Tamara Munzner Curves http://www.ugrad.cs.ubc.ca/~cs314/Vjan2013 2 Parametric Curves parametric form for a line:


  1. University of British Columbia Reading CPSC 314 Computer Graphics • FCG Chap 15 Curves Jan-Apr 2013 • Ch 13 2nd edition Tamara Munzner Curves http://www.ugrad.cs.ubc.ca/~cs314/Vjan2013 2 Parametric Curves • parametric form for a line: x x t ( 1 t ) x = + − 0 1 y y t ( 1 t ) y = + − 0 1 Curves z z t ( 1 t ) z = + − 0 1 • x, y and z are each given by an equation that involves: • parameter t • some user specified control points, x 0 and x 1 • this is an example of a parametric curve 3 4

  2. Splines Splines - History • a spline is a parametric curve defined by • draftsman used ‘ ducks ’ and strips of wood (splines) control points to draw curves • term “spline” dates from engineering drawing, • wood splines have second- where a spline was a piece of flexible wood order continuity, pass used to draw smooth curves through the control points a duck (weight) • control points are adjusted by the user to control shape of curve ducks trace out curve 5 6 Hermite Spline Basis Functions • a point on a Hermite curve is obtained by multiplying each • hermite spline is curve for which user control point by some function and summing • functions are called basis functions provides: • endpoints of curve • parametric derivatives of curve at endpoints 1.2 • parametric derivatives are dx/dt, dy/dt, dz/dt 1 0.8 x1 0.6 x0 • more derivatives would be required for higher 0.4 x'1 x'0 0.2 order curves 0 -0.2 -0.4 7 8

  3. Sample Hermite Curves Bézier Curves • similar to Hermite, but more intuitive definition of endpoint derivatives • four control points, two of which are knots 9 10 Bézier Curves Bézier Blending Functions • look at blending functions • derivative values of Bezier curve at knots dependent on adjacent points • family of polynomials called order-3 Bernstein polynomials • C(3, k) t k (1-t) 3-k ; 0<= k <= 3 • all positive in interval [0,1] • sum is equal to 1 11 12

  4. Bézier Blending Functions Bézier Curves • curve will always remain within convex hull (bounding region) defined by control points • every point on curve is linear combination of control points • weights of combination are all positive • sum of weights is 1 • therefore, curve is a convex combination of the control points 13 14 Bézier Curves Comparing Hermite and Bézier • interpolate between first, last control points Bézier Hermite • 1 st point ’ s tangent along line joining 1 st , 2 nd pts 1.2 1.2 1 1 • 4 th point ’ s tangent along line joining 3 rd , 4 th pts 0.8 0.8 B0 x1 0.6 B1 x0 0.6 0.4 B2 x'1 B3 x'0 0.2 0.4 0 0.2 -0.2 0 -0.4 15 16

  5. Rendering Bezier Curves: Simple Rendering Beziers: Subdivision • evaluate curve at fixed set of parameter values, join • a cubic Bezier curve can be broken into two points with straight lines shorter cubic Bezier curves that exactly cover • advantage: very simple original curve • disadvantages: • suggests a rendering algorithm: • expensive to evaluate the curve at many points • no easy way of knowing how fine to sample points, • keep breaking curve into sub-curves and maybe sampling rate must be different along • stop when control points of each sub-curve curve • no easy way to adapt: hard to measure deviation of are nearly collinear line segment from exact curve • draw the control polygon: polygon formed by control points 17 18 Sub-Dividing Bezier Curves Sub-Dividing Bezier Curves • step 1: find the midpoints of the lines joining • step 2: find the midpoints of the lines joining the original control vertices. call them M 01 , M 01 , M 12 and M 12 , M 23 . call them M 012 , M 123 M 12 , M 23 M 12 M 12 P 1 P 1 P 2 P 2 M 012 M 123 M 01 M 01 M 23 M 23 P 0 P 0 P 3 P 3 19 20

  6. Sub-Dividing Bezier Curves Sub-Dividing Bezier Curves • step 3: find the midpoint of the line joining • curve P 0 , M 01 , M 012 , M 0123 exactly follows original M 012 , M 123 . call it M 0123 from t =0 to t =0.5 • curve M 0123 , M 123 , M 23 , P 3 exactly follows original from t =0.5 to t =1 M 12 M 12 P 1 P 1 P 2 P 2 M 012 M 012 M 0123 M 0123 M 123 M 123 M 01 M 01 M 23 M 23 P 0 P 0 P 3 P 3 21 22 Sub-Dividing Bezier Curves de Casteljau ’ s Algorithm • continue process to create smooth curve • can find the point on a Bezier curve for any parameter value t with similar algorithm • for t=0.25 , instead of taking midpoints take points 0.25 of the way M 12 P 1 P 2 P 2 P 1 M 23 t=0.25 M 01 P 0 P 0 P 3 P 3 demo: www.saltire.com/applets/advanced_geometry/spline/spline.htm 23 24

  7. Longer Curves Piecewise Bezier: Continuity Problems • a single cubic Bezier or Hermite curve can only capture a small class of curves • at most 2 inflection points • one solution is to raise the degree • allows more control, at the expense of more control points and higher degree polynomials • control is not local, one control point influences entire curve • better solution is to join pieces of cubic curve together into piecewise cubic curves • total curve can be broken into pieces, each of which is cubic • local control: each control point only influences a limited part of the curve • interaction and design is much easier demo: www.cs.princeton.edu/~min/cs426/jar/bezier.html 25 26 Continuity Geometric Continuity • derivative continuity is important for animation • when two curves joined, typically want some • if object moves along curve with constant parametric degree of continuity across knot boundary speed, should be no sudden jump at knots • C0, “C-zero”, point-wise continuous, curves • for other applications, tangent continuity suffices share same point where they join • requires that the tangents point in the same direction • C1, “C-one”, continuous derivatives • referred to as G 1 geometric continuity • curves could be made C 1 with a re-parameterization • C2, “C-two”, continuous second derivatives • geometric version of C 2 is G 2 , based on curves having the same radius of curvature across the knot 27 28

  8. Achieving Continuity B-Spline Curve • start with a sequence of control points • Hermite curves • select four from middle of sequence • user specifies derivatives, so C 1 by sharing points and (p i-2 , p i-1 , p i , p i+1 ) derivatives across knot • Bezier and Hermite goes between p i-2 and p i+1 • Bezier curves • B-Spline doesn’t interpolate (touch) any of them but • they interpolate endpoints, so C 0 by sharing control pts approximates the going through p i-1 and p i • introduce additional constraints to get C 1 • parametric derivative is a constant multiple of vector joining first/ last 2 control points • so C 1 achieved by setting P 0,3 =P 1,0 =J , and making P 0,2 and J and P 6 P 2 P 1,1 collinear, with J-P 0,2 =P 1,1 -J P 1 • C 2 comes from further constraints on P 0,1 and P 1,2 • leads to... P 3 P 5 P 0 P 4 29 30 B-Spline B-Spline • by far the most popular spline used • locality of points • C 0 , C 1 , and C 2 continuous demo: www.siggraph.org/education/materials/HyperGraph/modeling/splines/demoprog/curve.html 31 32

Recommend


More recommend