1 / 28

CS559: Computer Graphics

CS559: Computer Graphics. Lecture 14: More on Curves Li Zhang Spring 2010. Catmull-Rom Cubics. Catmull-Rom Cubic Curves. Demo http://www.cse.unsw.edu.au/~lambert/splines/CatmullRom.html n control points define n-2 segments Changing 1 point affects neighboring 4 segments. Cardinal Cubics.

clarataylor
Download Presentation

CS559: Computer Graphics

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. CS559: Computer Graphics Lecture 14: More on Curves Li Zhang Spring 2010

  2. Catmull-Rom Cubics

  3. Catmull-Rom Cubic Curves • Demo • http://www.cse.unsw.edu.au/~lambert/splines/CatmullRom.html • n control points define n-2 segments • Changing 1 point affects neighboring 4 segments

  4. Cardinal Cubics s: tension control

  5. Cardinal Cubic Curves • 4 different s values

  6. Cardinal Cubics vs Lagrange Polynomials • Sacrifice higher order smoothness for • Local control • Avoid overshooting • When higher order smoothness may be important?

  7. Bezier Cubics

  8. Bezier Cubic Curves • Demo • http://www.cse.unsw.edu.au/~lambert/splines/Bezier.html

  9. Bezier Cubic Curves in Illustrator • Demo • Changing one control point will change 2 neighboring segments

  10. Generalization of Bezier

  11. Generalization of Bezier • If we have n=2 n=1

  12. Generalization of Bezier • If we have n=2 n=3 n=1

  13. Generalization of Bezier • If we have n=6 n=5 n=3 n=4 n=2

  14. Bezier Curve Properties • The first and last control points are interpolated • The tangent to the curve at the first control point is along the line joining the first and second control points • The tangent at the last control point is along the line joining the second last and last control points • K’th order derivative at 0 depends on p0 … pK • Why important? • Design curves with higher order continuity

  15. The curve lies entirely within the convex hull of its control points • The basis functions sum to 1 and are everywhere positive  convex combination • Terminologies: • Convex shape • convex hull • convex combination • Why important? • Collision detection

  16. Bezier Curve Properties • Reversing the control points yields the same curve • why? • The curves are affine invariant – Translating, scaling, rotating, or skewing the control points is the same as performing those operations on the curve itself. • Why important? • Efficient rendering • Subdivision for efficient rendering, editing, approximating.

  17. Geometric Interpretation: Line u p1 p0 1-u u 1-u (1-u)p0+up1 1-u u u p1 p0

  18. Geometric Interpretation: Quadratic p1 p0 p1 p2 u u 1-u u 1-u u 1-u u 1-u p(u) 1-u u u u p2 p0 http://www1.cs.columbia.edu/~cs4160/html06f/

  19. Geometric Interpretation: Cubic p0 p1 p2 p3 1-u u 1-u u u 1-u u p1 p2 1-u u 1-u u u 1-u u p(u) u p3 p0 http://www1.cs.columbia.edu/~cs4160/html06f/

  20. Changing u u=0.25, u=0.5, u=0.75 u=0.5 De Casteljau algorithm, Recursive Rendering

  21. Subdivision DeCasteljau(float p[N][3], float u) { for (int n = N-1; n >= 1; --n) { for (int j = 0; j < n; ++j) { p[j][0] = (1-u) * p[j][0] + u * p[j+1][0]; p[j][1] = (1-u) * p[j][1] + u * p[j+1][1]; p[j][2] = (1-u) * p[j][2] + u * p[j+1][2]; } } //(p[0][0], p[0][1], p[0][2]) saves the result } DeCasteljau(float p[N][3], float u) { for (int n = N-1; n >= 1; --n) { for (int j = 0; j < n; ++j) { p[j][0] += u*(p[j+1][0]-p[j][0]); p[j][1] += u*(p[j+1][1]-p[j][1]); p[j][2] += u*(p[j+1][2]-p[j][2]); } } //(p[0][0], p[0][1], p[0][2]) saves the result }

  22. Subdivision • Given a Bezier curve defined by P0, P1, P2, ..., Pn • we want to find two sets of n+1 control points Q0, Q1, Q2, ..., Qn and R0, R1, R2, ..., Rn such that • the Bézier curve defined by Qi's is the piece of the original Bézier curve on [0,u] • the Bézier curve defined by Ri's is the piece of the original Bézier curve on [u,1]

  23. Bezier Curve Subdivision p2 p1 u=0.5 p0 p3 http://www1.cs.columbia.edu/~cs4160/html06f/

  24. Bezier Curve Subdivision p2 p1 u=0.5 p0 p3 http://www1.cs.columbia.edu/~cs4160/html06f/

  25. A 6th degree subdivision example http://www.cs.mtu.edu/~shene/COURSES/cs3621/NOTES/spline/Bezier/bezier-sub.html

  26. Bezier Curve Subdivision • Why is subdivision useful? • Collision/intersection detection • Recursive search • Good for curve editing and approximation

More Related