19/13/ :20 UML Graphics II Parametric Curves and Surfaces Session 3
29/13/ :20 UML Parametric Curves and Surfaces: Key Concepts Point Curve, SurfaceCollection of points Parametric Representation (for a curve)
39/13/ :20 UML Parametric Curves and Surfaces Key Concepts, contd. Multiplying a point by a scalar:Scaling the representation Polynomial Control Points Set of (degree+1) points that bear some relation to the desired curve or surface Basis Functions Set of (degree + 1) polynomials that, when multiplied by the corresponding control points, produce the curve or surface
49/13/ :20 UML Continuity Considerations: C0 & C1 Continuity
59/13/ :20 UML How do we insure C 0 and C 1 continuity?
69/13/ :20 UML Bezier Curves: 1. Require interpolation at the endpoints of the curve: 2. Require that the line segments P 0 P 1 and P 3 P 2 match the first derivative of the curve at 0 and 1.
79/13/ :20 UML Calculating the Bezier Geometry Matrix
89/13/ :20 UML Calculating the Bezier Geometry Matrix
99/13/ :20 UML Bezier Blending Functions where This can be expressed:
109/13/ :20 UML Bezier Blending Functions:
119/13/ :20 UML Convex Hull Property: Curve must lie within this region known as “convex hull” of the control points.
129/13/ :20 UML Further look at the Bezier blending functions: These are an instance of the Bernstein Polynomials for k=3. Factoring the blending functions gives:
139/13/ :20 UML Bezier Curves: Code Example 120 goto 120
149/13/ :20 UML An interesting geometric construction
159/13/ :20 UML Recursive subdivision of Bezier curves
169/13/ :20 UML Bezier surface patch Convex hull of patch
179/13/ :20 UML Bezier surface patch Corner boundary conditions Four equations for each corner gives 16 total. Patch must interpolate the corner. Defines derivative in u direction. Defines derivative in v direction. “Twist”
189/13/ :20 UML Rendering the Bezier patch by recursive subdivision First subdivide curves of constant v. Connect new control points to form new curves. Finally subdivide these curves to form 4 new patches.
199/13/ :20 UML Recursive subdivision of Bezier curves
209/13/ :20 UML The Utah Teapot: 32 Bezier Patches
219/13/ :20 UML Utah Teapot: Polygon Representation
229/13/ :20 UML Rendering the Teapot
239/13/ :20 UML Conversion between curve representations Given a cubic Bezier curve expressed in terms of the Bezier geometry matrix, M B : The same curve can be expressed in terms of another polynomial basis with matrix M and matrix of control points q. Solving for q gives:
249/13/ :20 UML Conversion between curve representations: an example Suppose you have a matrix of four control points, q and a cubic interpolating those points q(u). The curve is obtained by the interpolating geometry matrix M I : where We want to find p such that:
259/13/ :20 UML Drawing Bezier curves and surfaces: Evaluators Evaluator Control Points Parameter Generation glMap1{fd}() glMap2{fd}() glEvalCoord1{fd}() glEvalCoord2{fd}() Parameter(s) Curve/surface value Establish Evaluator: Evaluate Points:
269/13/ :20 UML One Dimensional Evaluators Void glMap1{fd](GLenum target, TYPE u1, TYPE u2, Glint stride,Glint order, TYPE *points); target: specifies what the control points represent u1: beginning parameter value u2: end parameter value stride: number of values in each block of control point storage order: order of the Bezier curve (degree+1) *points: pointer to array of control points
279/13/ :20 UML One Dimensional Evaluators: target parameter GL_MAP_VERTEX_3x,y,z vertex coords. GL_MAP_VERTEX_4x,y,z,w vertex coords GL_MAP1_INDEXcolor index GL_MAP1_COLOR_4RGBA GL_MAP2_NORMALnormal coordinates GL_MAP1_TEXTURE_COORD_1s texture coords. GL_MAP1_TEXTURE_COORD_2s,t texture coords. GL_MAP1_TEXTURE_COORD_3s,t,r texture coords. GL_MAP1_TEXTURE_COORD_4s,t,r,q texture coords.
289/13/ :20 UML One Dimensional Evaluators: Code Example 120 goto 120 ?
299/13/ :20 UML Mesh Generation: One Dimensional void glMapGrid1{fd} (Glint n, TYPE u1, TYPE u2); Defines a grid that goes from u1 to u2 in n evenly spaced steps. void glEvalMesh1 (GLenum mode, GLint p1, Glint p2); mode is either GL_POINT or GL_LINE depending on whether you want to draw individual points or connected lines. p1, p2 are the grid values between which the mesh is to be evaluated
309/13/ :20 UML Two Dimensional Evaluators Void glMap2{fd](GLenum target, TYPE u1, TYPE u2, Glint ustride,Glint uorder, TYPE v1, TYPE v2, GLint vstride, Glint vorder, TYPE *points); target: specifies what the control points represent u1, v1: beginning parameter value u2, v2: end parameter value stride: number of values in each block of control point storage order: order of the Bezier curve (degree+1) *points: pointer to array of control points
319/13/ :20 UML Mesh Generation: Two Dimensional void glMapGrid2{fd} (GLint nu, TYPE u1, TYPE u2 GLint nv, TYPE v1, TYPE v2); Defines a two dimensional grid that goes from u1 to u2 in nu evenly spaced steps and from v1 to v2 in nv evenly spaced steps. void glEvalMesh2 (GLenum mode, GLint p1, GLint p2, GLint q1, GLint q2); mode is either GL_POINT, GL_LINE, or GL_FILL depending on whether you want to draw individual points, connected lines, or a filled mesh. p1, p2, q1, q2 are the grid values between which the mesh is to be evaluated
329/13/ :20 UML Two Dimensional Evaluators: Code Examples 120 goto 120