340 likes | 608 Views
Graphics II 91.547 Parametric Curves and Surfaces. Session 3. Parametric Curves and Surfaces: Key Concepts. Point. Curve, Surface Collection of points. Parametric Representation. (for a curve). Parametric Curves and Surfaces Key Concepts, contd.
E N D
Parametric Curves and Surfaces:Key Concepts Point Curve, Surface Collection of points Parametric Representation (for a curve)
Parametric Curves and SurfacesKey Concepts, contd. Multiplying a point by a scalar: Scaling the representation Polynomial Set of (degree+1) points that bear some relation to the desired curve or surface Control Points Set of (degree + 1) polynomials that, when multiplied by the corresponding control points, produce the curve or surface Basis Functions
Bezier Curves: 1. Require interpolation at the endpoints of the curve: 2. Require that the line segments P0 P1 and P3P2 match the first derivative of the curve at 0 and 1.
Bezier Blending Functions This can be expressed: where
Convex Hull Property: Curve must lie within this region known as “convex hull” of the control points.
Further look at the Bezier blending functions: Factoring the blending functions gives: These are an instance of the Bernstein Polynomials for k=3.
Bezier Curves:Code Example 120 goto 120
Bezier surface patch Convex hull of patch
Bezier surface patchCorner 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”
Connect new control points to form new curves. First subdivide curves of constant v. Rendering the Bezier patch by recursivesubdivision Finally subdivide these curves to form 4 new patches.
Conversion between curve representations Given a cubic Bezier curve expressed in terms of the Bezier geometry matrix, MB: 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:
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 matrixMI : where We want to find p such that:
Drawing Bezier curves and surfaces:Evaluators Parameter Generation Establish Evaluator: Parameter(s) glMap1{fd}() glMap2{fd}() Evaluator Curve/surface value Evaluate Points: glEvalCoord1{fd}() glEvalCoord2{fd}() Control Points
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
One Dimensional Evaluators:target parameter GL_MAP_VERTEX_3 x,y,z vertex coords. GL_MAP_VERTEX_4 x,y,z,w vertex coords GL_MAP1_INDEX color index GL_MAP1_COLOR_4 RGBA GL_MAP2_NORMAL normal coordinates GL_MAP1_TEXTURE_COORD_1 s texture coords. GL_MAP1_TEXTURE_COORD_2 s,t texture coords. GL_MAP1_TEXTURE_COORD_3 s,t,r texture coords. GL_MAP1_TEXTURE_COORD_4 s,t,r,q texture coords.
One Dimensional Evaluators:Code Example 120 goto 120 ?
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); modeis 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
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
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); modeis 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
Two Dimensional Evaluators:Code Examples 120 goto 120