CSE 470/598 Arizona State University Dianne Hansford Overview What is a parametric curve/surface? Why use parametric curves & surfaces? Bzier curves & surfaces NURBS Trimmed surfaces OpenGL library What is a parametric curve? Recall functions from calculus ...
Example: y = 2x 2x 2
Parametric curves give us more flexibility x y = x 2x 2x 2 To illustrate, we plot graph of function What is a parametric curve? 2D parametric curve takes the form x y f(t) g(t) Where f(t) and g(t) are functions of t = Example: Line thru points a and b x y (1-t) a x + t b x
(1-t) a y + t b y = Mapping of the real line to 2D: here t in [0,1] line segment a,b What is a parametric curve? 3D curves defined similarly x y z f(t) g(t) h(t) = Example: helix x y z cos(t) sin(t) t = Bzier Curves Polynomial parametric curves f(t), g(t), h(t) are polynomial functions Bzier curve b(t) Bzier control points b i Bzier polygon Curve mimics shape of polygon
t in [0,1] maps to curve between polygon b(0) = b 0 and b(1) = b n figure: degree n=3 (cubic) Bzier Curves Examples linear: b(t) = (1-t) b 0 + t b 1 quadratic: b(t) = (1-t) 2 b 0 + 2(1-t)t b 1 + t 2 b 2 cubic: b(t) = (1-t) 3 b 0 + 3(1-t) 2 t b 1
+ 3(1-t)t 2 b 2 + t 3 b 3 Bernstein basis B i n (t) = {n!/(n-i)! i!} (1-t) n-i t i n=1 n=2 n=3 Bzier Curves
Bzier Curves Bzier points and Bernstein basis Nice, intuitive method to create curves Variable display resolution Minimal storage needs Bzier Curves Bzier points and Bernstein basis Monomial basis: 1, t, t 2 , t 3 ,.... ex: quadratic a(t) = a 0 + t a 1 + t 2 a 2
a 0 is point on curve a 1 is first derivative vector a 2 is second derivative vector
Not very practical to design curves with! nice, intuitive method to create curves Compare to at t=0 Bzier Curves local and global parameter intervals Piecewise Bzier curves global parameter u e.g., time [u0,u1] [u1,u2] Each curve evaluated for t in [0,1] If specify u in global space then must find t in local space t = (u-u0) / (u1-u0) figure: 2 quadratic curves Bzier Curves Piecewise Bzier curves Conditions to create a smooth transition Filled squares are junction Bezier points -- start/endpoint of a curve Bzier Curves in OGL Basic steps: Define curve by specifying degree, control points and parameter space [u0,u1] Enable evaluator Call evaluator with parameter u in [u0, u1] Specify each u: glEvalCoord1*()
Autocreate uniformly spaced u: glMapGrid1*() glEvalMesh1() glMap1*() or Color and texture available too! Bzier Curve Evaluation de Casteljau algorithm another example of repeated subdivision On each polygon leg, construct a point in the ratio t : (1-t)
b n 0 (t) is point on curve figure: n=3 What is a parametric surface? 3D parametric surface takes the form x y z f(u,v) g(u,v) h(u,v) Where f,g,h are bivariate functions of u and v = mapping u,v-space to 3-space; this happens to be a function too Example:
x(u,v) = u v u 2 + v 2 Bzier Surface (Patch) Polynomial parametric surface f(u,v), g(u,v), h(u,v) are polynomial functions written in the Bernstein basis
Bzier surface b(u,v) Bzier control points b ij Bzier control net Bzier Surface Structure v (0,0) u (1,1) b 00 b 33 b 30 b 03 u v Bzier Surface Properties boundary curves lie on surface
boundary curves defined by boundary polygons Bzier Surface Properties Nice, intuitive method for creating surfaces
Variable display resolution
Minimal storage Bzier Surface Multiple patches connected smoothly Conditions on control net similar to curves difficult to do manually Bzier Surface Display wireframe shaded choose direction isoparametric curves OGL: glMap2*, glEvalCoord2* glMapGrid2, glEvalMesh2 OGL: triangles & normals created for you NURBS Non-uniform Rational B-splines B-splines are piecewise polynomials One or more Bezier curves /surfaces One control polygon Rational: lets us represent circles exactly GLU NURBS utility Trimmed Surfaces Parametric surface with parts of the domain invisible Jorg Peters UFL group GLU Trimmed NURBS utility Surf Lab domain References The Essentials of CAGD by Gerald Farin & DCH, AK Peters http://eros.cagd.eas.asu.edu/%7Efarin/essbook/essbook.h tml Ken Joys CAGD notes (UC Davis) http://graphics.cs.ucdavis.edu/CAGDNotes/homepage.html Jorg Peters UFL SurfLab group http://www.cise.ufl.edu/research/SurfLab/index.html OpenGL Red Book Chapter 12