Presentation is loading. Please wait.

Presentation is loading. Please wait.

CHAPTER 10 Curves and Surfaces Vivian by Richard S. Wright Jr.

Similar presentations


Presentation on theme: "CHAPTER 10 Curves and Surfaces Vivian by Richard S. Wright Jr."— Presentation transcript:

1

2 CHAPTER 10 Curves and Surfaces Vivian by Richard S. Wright Jr.

3

4 Objectives Introduce OpenGL evaluators Learn to render polynomial curves and surfaces Discuss quadrics in OpenGL - GLUT Quadrics - GLU Quadrics

5 What Does OpenGL Support? Evaluators: a general mechanism for working with the Bernstein polynomials - Can use any degree polynomials - Can use in 1-4 dimensions - Automatic generation of normals and texture coordinates - NURBS supported in GLU Quadrics –GLU and GLUT contain polynomial approximations of quadrics

6 Quadrics

7 Void gluQuadricDrawStyle(GLUquadricObj *obj, GLenum drawStyle); void gluQuadricNormals(GLUquadricObj *pbj, GLenum normals);

8 Draw a quadrics Draw a sphere: –void gluSphere(GLUQuadricObj *obj, GLdouble radius, GLint slices, GLint stacks);

9 Draw a quadrics void gltDrawUnitAxes(void)

10 Curves and Surfaces Overview What is a parametric curve/surface? Why use parametric curves & surfaces? B é zier curves & surfaces NURBS Trimmed surfaces OpenGL library

11 What is a parametric curve? 2D parametric curve takes the form xyxy f(t) g(t) Where f(t) and g(t) are functions of t = Example: Line thru points a and b xyxy (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 y = mx + b

12 What is a parametric curve? 3D curves defined similarly xyzxyz f(t) g(t) h(t) = Example: helix xyzxyz cos(t) sin(t) t =

13 Parametric representation of curves and surfaces.

14 Control Points The order of the curve is represented by the number of control points used to describe its shape. The degree is one less than the order of the curve.

15 B é zier Curves Example s 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

16 Continuity

17 B é zier Curves in OpenGL 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!

18 What is a parametric surface? 3D parametric surface takes the form xyzxyz 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

19 B é zier Surfaces in OpenGL Basic steps:  Define curve by specifying degree, control points and parameter space [u0,u1]  Enable evaluator  Call evaluator with parameter u in [u0, u1,v0, v1] glMap2*()

20 B é zier Surface Multiple patches connected smoothly Conditions on control net similar to curves … difficult to do manually

21 NURBS Non-uniform Rational B-splines B-splines are piecewise polynomials One or more Bezier curves /surfaces One control polygon Rational: let’s us represent circles exactly GLU NURBS utility

22 From Bézier to B-Splines

23 Creating a NURBS Surface Evaluator → NURBS Knots

24 Trimming

25 Trimmed Surfaces Parametric surface with parts of the domain “ invisible ” Jorg Peters’ UFL group GLU Trimmed NURBS utility Surf Lab domain


Download ppt "CHAPTER 10 Curves and Surfaces Vivian by Richard S. Wright Jr."

Similar presentations


Ads by Google