# March 1, 2009Dr. Muhammed Al-Mulhem1 ICS 415 Computer Graphics Hermite Splines Dr. Muhammed Al-Mulhem March 1, 2009 Dr. Muhammed Al-Mulhem March 1, 2009.

## Presentation on theme: "March 1, 2009Dr. Muhammed Al-Mulhem1 ICS 415 Computer Graphics Hermite Splines Dr. Muhammed Al-Mulhem March 1, 2009 Dr. Muhammed Al-Mulhem March 1, 2009."— Presentation transcript:

March 1, 2009Dr. Muhammed Al-Mulhem1 ICS 415 Computer Graphics Hermite Splines Dr. Muhammed Al-Mulhem March 1, 2009 Dr. Muhammed Al-Mulhem March 1, 2009

Dr. Muhammed Al-Mulhem2 Spline A spline is a a flexible strip used to produce a smooth curve through a set of points.A spline is a a flexible strip used to produce a smooth curve through a set of points.

March 1, 2009Dr. Muhammed Al-Mulhem3 Representations of Curves A curve can be represented using: – –A sequence of points. – –A piecewise polynomial functions. A spline curve refers to any composite curve formed with polynomial sections. A curve can be represented using: – –A sequence of points. – –A piecewise polynomial functions. A spline curve refers to any composite curve formed with polynomial sections.

March 1, 2009Dr. Muhammed Al-Mulhem4 Specifying Curves A spline curve is specified as follows: – –Giving a set of coordinate positions, called control Points, which indicate the general shape of the curve. – –These points are then fitted with piecewise polynomial functions in one of two ways:   Interpolation   Approximation A spline curve is specified as follows: – –Giving a set of coordinate positions, called control Points, which indicate the general shape of the curve. – –These points are then fitted with piecewise polynomial functions in one of two ways:   Interpolation   Approximation

March 1, 2009Dr. Muhammed Al-Mulhem5 Specifying Curves Interpolation: – –When polynomial sections are fitted so that all the control points are on the curve, the resulting curve is said to interpolate the set of control points. Interpolation: – –When polynomial sections are fitted so that all the control points are on the curve, the resulting curve is said to interpolate the set of control points.

March 1, 2009Dr. Muhammed Al-Mulhem6 Specifying Curves Approximation – –When polynomial sections are fitted so that some or all the control points are not on the curve, the resulting curve is said to approximate the set of control points. Approximation – –When polynomial sections are fitted so that some or all the control points are not on the curve, the resulting curve is said to approximate the set of control points.

March 1, 2009Dr. Muhammed Al-Mulhem7 Parametric Continuity To ensure a smooth transition from one section of a piecewise parametric spline to the next, we impose various continuity conditions at the connection points. If each section of a spline curve is described with a set of parametric coordinate function of the form x = x(u), y= y(u), z = z(u), u 1 <= u <= u 2 We set parametric continuity by matching the parametric derivatives of adjoining curve sections at their common boundary. To ensure a smooth transition from one section of a piecewise parametric spline to the next, we impose various continuity conditions at the connection points. If each section of a spline curve is described with a set of parametric coordinate function of the form x = x(u), y= y(u), z = z(u), u 1 <= u <= u 2 We set parametric continuity by matching the parametric derivatives of adjoining curve sections at their common boundary.

March 1, 2009Dr. Muhammed Al-Mulhem8 Parametric Continuity Various continuity conditions: C 0 continuity (Zero-order parametric continuity): – –Means simply that curves meet. That is, the values of x, y, and z evaluated at u 2 for the first curve section are equal, respectively, to the values of x, y, and z evaluated at u 1 of the next curve section. Various continuity conditions: C 0 continuity (Zero-order parametric continuity): – –Means simply that curves meet. That is, the values of x, y, and z evaluated at u 2 for the first curve section are equal, respectively, to the values of x, y, and z evaluated at u 1 of the next curve section.

March 1, 2009Dr. Muhammed Al-Mulhem9 Parametric Continuity C 1 continuity (First-order parametric continuity): – –Means that is the first parametric derivatives (tangent line) of the coordinate functions (above equations in slide 7) for two successive curve sections are equal at their joining point. C 1 continuity (First-order parametric continuity): – –Means that is the first parametric derivatives (tangent line) of the coordinate functions (above equations in slide 7) for two successive curve sections are equal at their joining point.

March 1, 2009Dr. Muhammed Al-Mulhem10 Parametric Continuity C 2 continuity (Second-order parametric continuity): – –Means that both the first and second parametric derivatives of the two curve sections are the same at the intersection. Higher order parametric continuity conditions are defined similarly. C 2 continuity (Second-order parametric continuity): – –Means that both the first and second parametric derivatives of the two curve sections are the same at the intersection. Higher order parametric continuity conditions are defined similarly.

March 1, 2009Dr. Muhammed Al-Mulhem11 Parametric Continuity

March 1, 2009Dr. Muhammed Al-Mulhem12 Parametric Continuity

March 1, 2009Dr. Muhammed Al-Mulhem13 Cubic Spline Cubic spline requires less calculations and storage space, and more stable than higher-order polynomials. Given a set of control points, cubic interpolation splines are obtained by fitting the input points with a piecewise cubic polynomial curve that passes through every control point. Cubic spline requires less calculations and storage space, and more stable than higher-order polynomials. Given a set of control points, cubic interpolation splines are obtained by fitting the input points with a piecewise cubic polynomial curve that passes through every control point.

March 1, 2009Dr. Muhammed Al-Mulhem14 Cubic Polynomials A parametric cubic polynomial that is to be fitted between each pair of control points with the following equations: x(t) = a x t 3 + b x t 2 + c x t + d x y(t) = a x t 3 + b x t 2 + c x t + d x z(t) = a x t 3 + b x t 2 + c x t + d x 0 <= t <= 1 A parametric cubic polynomial that is to be fitted between each pair of control points with the following equations: x(t) = a x t 3 + b x t 2 + c x t + d x y(t) = a x t 3 + b x t 2 + c x t + d x z(t) = a x t 3 + b x t 2 + c x t + d x 0 <= t <= 1

March 1, 2009Dr. Muhammed Al-Mulhem15 Cubic Polynomials Let T = [t 3 t 2 t 1] Coefficient Matrix C The the cuve Q(t) can be represented as: Q(t) = T*C Let T = [t 3 t 2 t 1] Coefficient Matrix C The the cuve Q(t) can be represented as: Q(t) = T*C

March 1, 2009Dr. Muhammed Al-Mulhem16 Parametric Curves How do we find the tangent to a curve? If f(x) = x 2 -4 – –tangent at (x=3) is   f’(x) = 2x - 4 = 2(3) - 4 = 2 How do we find the tangent to a curve? If f(x) = x 2 -4 – –tangent at (x=3) is   f’(x) = 2x - 4 = 2(3) - 4 = 2 Derivative of Q(t) is the tangent vector at t:

March 1, 2009Dr. Muhammed Al-Mulhem17 Piecewise Curve Segments One curve constructed by connecting many smaller segments end-to-end Must have rules for how the segments are joined Continuity describes the joint Parametric continuity Geometric continuity One curve constructed by connecting many smaller segments end-to-end Must have rules for how the segments are joined Continuity describes the joint Parametric continuity Geometric continuity

March 1, 2009Dr. Muhammed Al-Mulhem18 Parametric Continuity C 1 is tangent continuity (velocity)C 1 is tangent continuity (velocity) C 2 is 2 nd derivative continuity (acceleration)C 2 is 2 nd derivative continuity (acceleration) Matching direction and magnitude of d n / dt nMatching direction and magnitude of d n / dt n  C n continous C 1 is tangent continuity (velocity)C 1 is tangent continuity (velocity) C 2 is 2 nd derivative continuity (acceleration)C 2 is 2 nd derivative continuity (acceleration) Matching direction and magnitude of d n / dt nMatching direction and magnitude of d n / dt n  C n continous

March 1, 2009Dr. Muhammed Al-Mulhem19 Geometric Continuity Requires the parametric dervatives of the two sections are prportional to each other at their common boundary, instead of requiring equality. If positions match G 0 geometric continuity If direction (but not necessarily magnitude) of tangent matches G 1 geometric continuity The tangent value at the end of one curve is proportional to the tangent value of the beginning of the next curve Requires the parametric dervatives of the two sections are prportional to each other at their common boundary, instead of requiring equality. If positions match G 0 geometric continuity If direction (but not necessarily magnitude) of tangent matches G 1 geometric continuity The tangent value at the end of one curve is proportional to the tangent value of the beginning of the next curve

March 1, 2009Dr. Muhammed Al-Mulhem20 Parametric Cubic Curves In order to assure C 2 continuity, curves must be of at least degree 3 Here is the parametric definition of a cubic (degree 3) spline in two dimensions How do we extend it to three dimensions? In order to assure C 2 continuity, curves must be of at least degree 3 Here is the parametric definition of a cubic (degree 3) spline in two dimensions How do we extend it to three dimensions?

March 1, 2009Dr. Muhammed Al-Mulhem21 Parametric Cubic Splines Can represent this as a matrix.

March 1, 2009Dr. Muhammed Al-Mulhem22 Coefficients So how do we select the coefficients? The coefficients [a x b x c x d x ] and [a y b y c y d y ] must satisfy the constraints defined by the continuity conditions So how do we select the coefficients? The coefficients [a x b x c x d x ] and [a y b y c y d y ] must satisfy the constraints defined by the continuity conditions

March 1, 2009Dr. Muhammed Al-Mulhem23 Parametric Curves There are many splines developed, some of these are: – –Hermite – –Bezier There are many splines developed, some of these are: – –Hermite – –Bezier

March 1, 2009Dr. Muhammed Al-Mulhem24 Hermite Splines A Hermite spline is an interpolating cubic polynomial with a specified tangent at each control point. It can be adjusted locally because each curve section is only dependent on its endpoint constraints. A Hermite spline is an interpolating cubic polynomial with a specified tangent at each control point. It can be adjusted locally because each curve section is only dependent on its endpoint constraints.

March 1, 2009Dr. Muhammed Al-Mulhem25 Hermite Cubic Splines One cubic curve for each dimension. A curve constrained to x/y-plane has two curves. One cubic curve for each dimension. A curve constrained to x/y-plane has two curves.

March 1, 2009Dr. Muhammed Al-Mulhem26 Hermite Cubic Splines A 2-D Hermite Cubic Spline is defined by eight parameters: a, b, c, d, e, f, g, h How do we convert the intuitive endpoint constraints into these (relatively) unintuitive eight parameters? We know: (x, y) position at t = 0, p 1(x, y) position at t = 0, p 1 (x, y) position at t = 1, p 2(x, y) position at t = 1, p 2 (x, y) derivative at t = 0, dp/dt(x, y) derivative at t = 0, dp/dt (x, y) derivative at t = 1, dp/dt(x, y) derivative at t = 1, dp/dt A 2-D Hermite Cubic Spline is defined by eight parameters: a, b, c, d, e, f, g, h How do we convert the intuitive endpoint constraints into these (relatively) unintuitive eight parameters? We know: (x, y) position at t = 0, p 1(x, y) position at t = 0, p 1 (x, y) position at t = 1, p 2(x, y) position at t = 1, p 2 (x, y) derivative at t = 0, dp/dt(x, y) derivative at t = 0, dp/dt (x, y) derivative at t = 1, dp/dt(x, y) derivative at t = 1, dp/dt

March 1, 2009Dr. Muhammed Al-Mulhem27 Hermite Cubic Spline We know: (x, y) position at t = 0, p 1 We know: (x, y) position at t = 0, p 1

March 1, 2009Dr. Muhammed Al-Mulhem28 Hermite Cubic Spline We know: (x, y) position at t = 1, p 2 We know: (x, y) position at t = 1, p 2

March 1, 2009Dr. Muhammed Al-Mulhem29 Hermite Cubic Splines So far we have four equations, but we have eight unknowns Use the derivatives So far we have four equations, but we have eight unknowns Use the derivatives

March 1, 2009Dr. Muhammed Al-Mulhem30 Hermite Cubic Spline We know: (x, y) derivative at t = 0, dp/dt We know: (x, y) derivative at t = 0, dp/dt

March 1, 2009Dr. Muhammed Al-Mulhem31 Hermite Cubic Spline We know: (x, y) derivative at t = 1, dp/dt We know: (x, y) derivative at t = 1, dp/dt

March 1, 2009Dr. Muhammed Al-Mulhem32 Hermite Specification Matrix equation for Hermite Curve t = 0 t = 1 t = 0 t = 1 t 3 t 2 t 1 t 0 p1p1 p2p2 r p 1 r p 2

March 1, 2009Dr. Muhammed Al-Mulhem33 Solve Hermite Matrix

March 1, 2009Dr. Muhammed Al-Mulhem34 Spline and Geometry Matrices M Hermite G Hermite

March 1, 2009Dr. Muhammed Al-Mulhem35 Resulting Hermite Spline Equation

March 1, 2009Dr. Muhammed Al-Mulhem36 Sample Hermite Curves

March 1, 2009Dr. Muhammed Al-Mulhem37 Hermite Curves If P(u) represents a parametric cubic point functionfor the cuve section between control points P k and P k+1 as shown bellow: PkPk P k+1 P(u) = (x(u), y(u), z(u)), where x(u)=a x u 3 + b x u 2 + c x u + d x y(u)=a y u 3 + b y u 2 + c y u + d y z(u)=a z u 3 + b z u 2 + c z u + d z

March 1, 2009Dr. Muhammed Al-Mulhem38 Hermite Curves The boundary conditions that define this Hermite curve section are:   P(0) = P k   P(1) = P k+1   P’(0) = D Pk   P’(1) = D Pk+1 With D Pk and D Pk+1 specifying the values for the parametric derivatives at control points P k and P k+1 The boundary conditions that define this Hermite curve section are:   P(0) = P k   P(1) = P k+1   P’(0) = D Pk   P’(1) = D Pk+1 With D Pk and D Pk+1 specifying the values for the parametric derivatives at control points P k and P k+1

March 1, 2009Dr. Muhammed Al-Mulhem39 Hermite Curves We can write the vector equivalent for the Hermit curve section as: – –P(u) = a u 3 + b u 2 + cu + d 0<= u <= 1 Where the x, y and z components of P(u) is x(u)=a x u 3 + b x u 2 + c x u + d x y(u)=a y u 3 + b y u 2 + c y u + d y z(u)=a z u 3 + b z u 2 + c z u + d z We can write the vector equivalent for the Hermit curve section as: – –P(u) = a u 3 + b u 2 + cu + d 0<= u <= 1 Where the x, y and z components of P(u) is x(u)=a x u 3 + b x u 2 + c x u + d x y(u)=a y u 3 + b y u 2 + c y u + d y z(u)=a z u 3 + b z u 2 + c z u + d z

March 1, 2009Dr. Muhammed Al-Mulhem40 Hermite Curves The matrix equivalent is And the derivative of the point function is The matrix equivalent is And the derivative of the point function is

March 1, 2009Dr. Muhammed Al-Mulhem41 Hermite Curves Substituting endpoint values 0 and 1 for parameter u into the above two equations, we can express the Hermite boundary conditions in the matrix form

March 1, 2009Dr. Muhammed Al-Mulhem42 Hermite Curves Solving this equation for the polynomial coefficients, we have M H, the Hermite matrix, is the inverse of the boundary condition matrix. Solving this equation for the polynomial coefficients, we have M H, the Hermite matrix, is the inverse of the boundary condition matrix.

March 1, 2009Dr. Muhammed Al-Mulhem43 Hermite Curves The above matrix can be written in terms of the boundary conditions as This can be used to determine the expressions for the polynomial Herimte functions. The above matrix can be written in terms of the boundary conditions as This can be used to determine the expressions for the polynomial Herimte functions.

March 1, 2009Dr. Muhammed Al-Mulhem44 Hermite Blending Functions The above matrix can be used to determine the expressions for the polynomial Herimte functions, – –H k (u) for k=0,1,2,3 This can be done by carrying out the matrix multiplications and collecting coefficient for the boundary conditions to obtain the polynomial form: P(u) = P k (2u 3 - 3u 2 + 1) + P k+1 (-2u 3 + 3u 2 ) + D Pk (u 3 -2u 2 + u) + D Pk+1 (u 3 u 2 ) = P k H 0 (u) + P k+1 H 1 (u) + D Pk H 2 (u) + D Pk+1 H 3 (u) The above matrix can be used to determine the expressions for the polynomial Herimte functions, – –H k (u) for k=0,1,2,3 This can be done by carrying out the matrix multiplications and collecting coefficient for the boundary conditions to obtain the polynomial form: P(u) = P k (2u 3 - 3u 2 + 1) + P k+1 (-2u 3 + 3u 2 ) + D Pk (u 3 -2u 2 + u) + D Pk+1 (u 3 u 2 ) = P k H 0 (u) + P k+1 H 1 (u) + D Pk H 2 (u) + D Pk+1 H 3 (u)

March 1, 2009Dr. Muhammed Al-Mulhem45 Blending Functions

Download ppt "March 1, 2009Dr. Muhammed Al-Mulhem1 ICS 415 Computer Graphics Hermite Splines Dr. Muhammed Al-Mulhem March 1, 2009 Dr. Muhammed Al-Mulhem March 1, 2009."

Similar presentations