Presentation is loading. Please wait.

Presentation is loading. Please wait.

CSCI480/582 Lecture 10 Chap.2.3 Cubic Splines – B-Splines and NURBS Feb, 13, 2009.

Similar presentations


Presentation on theme: "CSCI480/582 Lecture 10 Chap.2.3 Cubic Splines – B-Splines and NURBS Feb, 13, 2009."— Presentation transcript:

1 CSCI480/582 Lecture 10 Chap.2.3 Cubic Splines – B-Splines and NURBS Feb, 13, 2009

2 Outline B-spline NURBS Generalization from curve to surface Calculate arc length Working with distance-time function

3 B-Spline – Basis Spline Theorem: every spline function of a given degree, smoothness, knot vector, and control points, can be represented as a linear combination of B- splines in the same spline space.

4 B-Spline Examples Uniform B-spline Uniform cubic B-spline

5 Non-uniform rational B-splines P0P0 P1P1 P2P2 P3P3 P4P4 P5P5 T 0, T 1,T 2 T3T3 T4T4 T5T5 T6T6 T 7, T 8,T 9 Cubic NURBS  Positional(0 th derivative), tangential(1 st derivative), curvature(2 nd derivative) continuity Invariant under affine and perspective transformation to the control points

6 Generalization from Curve to Surface Curve: vector valued function parameterized by a scalar parameter variable of u Surface: vector valued function parameterized by a two-element vector parameter variable of [u, v]

7 Calculate Arc-length of a curve Matrix representation of a Bezier curve Matrix representation of its Derivative vector Integration implemented by Piece-wise linear approximation

8 Working with distance-time function frame Arc length Speed=c frame Arc length Ease-in /ease-out Given two curves  C(u): vector function representing geometric path  S(t): scalar function representing distance-time relationship Animation of a rigid object along a path can be implemented by  t->s(t)->argLength2parameter->C(u) Applications are responsible For this conversion

9 OpenGL support of curves GLfloat ctrlpoints[4][3] = { { -4.0, -4.0, 0.0}, { -2.0, 4.0, 0.0}, {2.0, -4.0, 0.0}, {4.0, 4.0, 0.0}}; void myinit(void) { glClearColor(0.0, 0.0, 0.0, 1.0); glMap1f(GL_MAP1_VERTEX_3, 0.0, 1.0, 3, 4,&ctrlpoints[0][0]); glEnable(GL_MAP1_VERTEX_3); glShadeModel(GL_FLAT); } void display(void) { int i; glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glColor3f(1.0, 1.0, 1.0); glBegin(GL_LINE_STRIP); for (i = 0; i <= 30; i++) glEvalCoord1f((GLfloat) i/30.0); glEnd(); /* The following code displays the control points as dots. */ glPointSize(5.0); glColor3f(1.0, 1.0, 0.0); glBegin(GL_POINTS); for (i = 0; i < 4; i++) glVertex3fv(&ctrlpoints[i][0]); glEnd(); glFlush(); }


Download ppt "CSCI480/582 Lecture 10 Chap.2.3 Cubic Splines – B-Splines and NURBS Feb, 13, 2009."

Similar presentations


Ads by Google