Presentation is loading. Please wait.

Presentation is loading. Please wait.

Lecture 29 of 42 Bezier Curves and Splines Wednesday, 02 April 2008

Similar presentations


Presentation on theme: "Lecture 29 of 42 Bezier Curves and Splines Wednesday, 02 April 2008"— Presentation transcript:

1 Lecture 29 of 42 Bezier Curves and Splines Wednesday, 02 April 2008
William H. Hsu Department of Computing and Information Sciences, KSU KSOL course pages: Course web site: Instructor home page: Readings: Sections 11.1 – 11.6, Eberly 2e – see CIS 636/736: (Introduction to) Computer Graphics Lecture 27 of 42

2 CSE167: Computer Graphics Instructor: Steve Rotenberg UCSD, Fall 2006
Cubic Curves CSE167: Computer Graphics Instructor: Steve Rotenberg UCSD, Fall 2006 © 2006 Rotenberg, S., University of California San Diego CIS 636/736: (Introduction to) Computer Graphics Lecture 27 of 42

3 Understanding and Using OpenGL EvalMesh/EvalCurve
Render a smooth, cubic surface by tessellating it into a set of triangles See: evalMesh*d © 2006 Rotenberg, S., University of California San Diego CIS 636/736: (Introduction to) Computer Graphics Lecture 27 of 42

4 Polynomial Functions Linear: Quadratic: Cubic:
CIS 636/736: (Introduction to) Computer Graphics Lecture 27 of 42

5 Vector Polynomials (Curves)
Linear: Quadratic: Cubic: We usually define the curve for 0 ≤ t ≤ 1 CIS 636/736: (Introduction to) Computer Graphics Lecture 27 of 42

6 . Linear Interpolation b t=1 a 0<t<1 t=0
Linear interpolation (Lerp) is a common technique for generating a new value that is somewhere in between two other values A ‘value’ could be a number, vector, color, or even something more complex like an entire 3D object… Consider interpolating between two points a and b by some parameter t a b t=1 . 0<t<1 t=0 CIS 636/736: (Introduction to) Computer Graphics Lecture 27 of 42

7 Bezier Curves p1 p1 p2 p3 p1 p0 p0 p0 p2 Linear Quadratic Cubic
Bezier curves can be thought of as a higher order extension of linear interpolation p1 p1 p2 p3 p1 p0 p0 p0 p2 Linear Quadratic Cubic CIS 636/736: (Introduction to) Computer Graphics Lecture 27 of 42

8 Bezier Curve Formulation
There are lots of ways to formulate Bezier curves mathematically. Some of these include: de Castlejau (recursive linear interpolations) Bernstein polynomials (functions that define the influence of each control point as a function of t) Cubic equations (general cubic equation of t) Matrix form We will briefly examine each of these CIS 636/736: (Introduction to) Computer Graphics Lecture 27 of 42

9 Bezier Curve • x(t) p1 p0 p2 p3
Find the point x on the curve as a function of parameter t: p1 x(t) p0 p2 p3 CIS 636/736: (Introduction to) Computer Graphics Lecture 27 of 42

10 de Casteljau Algorithm
The de Casteljau algorithm describes the curve as a recursive series of linear interpolations This form is useful for providing an intuitive understanding of the geometry involved, but it is not the most efficient form CIS 636/736: (Introduction to) Computer Graphics Lecture 27 of 42

11 de Casteljau Algorithm
We start with our original set of points In the case of a cubic Bezier curve, we start with four points p1 p0 p2 p3 CIS 636/736: (Introduction to) Computer Graphics Lecture 27 of 42

12 de Casteljau Algorithm
p1 q1 q0 p0 p2 q2 p3 CIS 636/736: (Introduction to) Computer Graphics Lecture 27 of 42

13 de Casteljau Algorithm
q1 r0 q0 r1 q2 CIS 636/736: (Introduction to) Computer Graphics Lecture 27 of 42

14 de Casteljau Algorithm
x r1 CIS 636/736: (Introduction to) Computer Graphics Lecture 27 of 42

15 Bezier Curve p1 x p0 p2 p3 CIS 636/736: (Introduction to) Computer Graphics Lecture 27 of 42

16 Recursive Linear Interpolation
CIS 636/736: (Introduction to) Computer Graphics Lecture 27 of 42

17 Expanding the Lerps CIS 636/736: (Introduction to) Computer Graphics
Lecture 27 of 42

18 Bernstein Polynomial Form
CIS 636/736: (Introduction to) Computer Graphics Lecture 27 of 42

19 Cubic Bernstein Polynomials
CIS 636/736: (Introduction to) Computer Graphics Lecture 27 of 42

20 Bernstein Polynomials
CIS 636/736: (Introduction to) Computer Graphics Lecture 27 of 42

21 Bernstein Polynomials
CIS 636/736: (Introduction to) Computer Graphics Lecture 27 of 42

22 Bernstein Polynomials
Bernstein polynomial form of a Bezier curve: CIS 636/736: (Introduction to) Computer Graphics Lecture 27 of 42

23 Bernstein Polynomials
We start with the de Casteljau algorithm, expand out the math, and group it into polynomial functions of t multiplied by points in the control mesh The generalization of this gives us the Bernstein form of the Bezier curve This gives us further understanding of what is happening in the curve: We can see the influence of each point in the control mesh as a function of t We see that the basis functions add up to 1, indicating that the Bezier curve is a convex average of the control points CIS 636/736: (Introduction to) Computer Graphics Lecture 27 of 42

24 Cubic Equation Form CIS 636/736: (Introduction to) Computer Graphics
Lecture 27 of 42

25 Cubic Equation Form CIS 636/736: (Introduction to) Computer Graphics
Lecture 27 of 42

26 Cubic Equation Form If we regroup the equation by terms of exponents of t, we get it in the standard cubic form This form is very good for fast evaluation, as all of the constant terms (a,b,c,d) can be precomputed The cubic equation form obscures the input geometry, but there is a one-to-one mapping between the two and so the geometry can always be extracted out of the cubic coefficients CIS 636/736: (Introduction to) Computer Graphics Lecture 27 of 42

27 Cubic Matrix Form CIS 636/736: (Introduction to) Computer Graphics
Lecture 27 of 42

28 Cubic Matrix Form CIS 636/736: (Introduction to) Computer Graphics
Lecture 27 of 42

29 Matrix Form CIS 636/736: (Introduction to) Computer Graphics
Lecture 27 of 42

30 Matrix Form We can rewrite the equations in matrix form
This gives us a compact notation and shows how different forms of cubic curves can be related It also is a very efficient form as it can take advantage of existing 4x4 matrix hardware support… CIS 636/736: (Introduction to) Computer Graphics Lecture 27 of 42

31 Bezier Curves & Cubic Curves
By adjusting the 4 control points of a cubic Bezier curve, we can represent any cubic curve Likewise, any cubic curve can be represented uniquely by a cubic Bezier curve There is a one-to-one mapping between the 4 Bezier control points (p0,p1,p2,p3) and the pure cubic coefficients (a,b,c,d) The Bezier basis matrix BBez (and it’s inverse) perform this mapping There are other common forms of cubic curves that also retain this property (Hermite, Catmull-Rom, B-Spline) CIS 636/736: (Introduction to) Computer Graphics Lecture 27 of 42

32 Derivatives Finding the derivative (tangent) of a curve is easy:
CIS 636/736: (Introduction to) Computer Graphics Lecture 27 of 42

33 Tangents The derivative of a curve represents the tangent vector to the curve at some point CIS 636/736: (Introduction to) Computer Graphics Lecture 27 of 42

34 Convex Hull Property p3 p1 p0 p2
If we take all of the control points for a Bezier curve and construct a convex polygon around them, we have the convex hull of the curve An important property of Bezier curves is that every point on the curve itself will be somewhere within the convex hull of the control points p3 p1 p0 p2 CIS 636/736: (Introduction to) Computer Graphics Lecture 27 of 42

35 Continuity A cubic curve defined for t ranging from 0 to 1 will form a single continuous curve and not have any gaps We say that it has geometric continuity, or C0 continuity We can easily see that the first derivative will be a continuous quadratic function and the second derivative will be a continuous linear function The third derivative (and all others) are continuous as well, but in a trivial way (constant), so we generally just say that a cubic curve has second derivative continuity or C2 continuity In general, the higher the continuity value, the ‘smoother’ the curve will be, although it’s actually a little more complicated than that… CIS 636/736: (Introduction to) Computer Graphics Lecture 27 of 42

36 Interpolation / Approximation
We say that cubic Bezier curves interpolate the two endpoints (p0 & p3), but only approximate the interior points (p1 & p2) In geometric design applications, it is often desirable to be able to make a single curve that interpolates through several points CIS 636/736: (Introduction to) Computer Graphics Lecture 27 of 42

37 Piecewise Curves Rather than use a very high degree curve to interpolate a large number of points, it is more common to break the curve up into several simple curves For example, a large complex curve could be broken into cubic curves, and would therefore be a piecewise cubic curve For the entire curve to look smooth and continuous, it is necessary to maintain C1 continuity across segments, meaning that the position and tangents must match at the endpoints For smoother looking curves, it is best to maintain the C2 continuity as well CIS 636/736: (Introduction to) Computer Graphics Lecture 27 of 42

38 Connecting Bezier Curves
A simple way to make larger curves is to connect up Bezier curves Consider two Bezier curves defined by p0…p3 and v0…v3 If p3=v0, then they will have C0 continuity If (p3-p2)=(v1-v0), then they will have C1 continuity C2 continuity is more difficult… v1 p2 p2 v3 p1 P3 v0 v3 p1 v1 P3 v0 v2 p0 v2 p0 C1 continuity C0 continuity CIS 636/736: (Introduction to) Computer Graphics Lecture 27 of 42


Download ppt "Lecture 29 of 42 Bezier Curves and Splines Wednesday, 02 April 2008"

Similar presentations


Ads by Google