Post on 27-Dec-2015
204/19/23 15:32
UML
Parametric Curves and Surfaces:Key Concepts
Point
1
z
y
x
Curve, Surface Collection of points
Parametric Representation 1...0
1
)(
)(
)(
uuz
uy
ux
(for a curve)
304/19/23 15:32
UML
Parametric Curves and SurfacesKey Concepts, contd.
Multiplying a point by a scalar: Scaling the representation
Polynomial
33
2210
0
)(
)(
ucucuccux
uu
xxxx
n
k
kk
cp
Control Points Set of (degree+1) points that bear somerelation to the desired curve or surface
Basis FunctionsSet of (degree + 1) polynomials that, whenmultiplied by the corresponding controlpoints, produce the curve or surface
404/19/23 15:32
UML
Continuity Considerations: C0 & C1 Continuity
zyx du
udz
du
udy
du
udx
du
udiii
p )()()()(
p( )u
604/19/23 15:32
UML
Bezier Curves:
1. Require interpolation at the endpoints of the curve:
p p
p po
( )
( )
0
13
2. Require that the line segments P0 P1 and P3P2 match the first derivative of the curve at 0 and 1.
p1
p0
p2
p3
pp p
p p
pp p
p p
'( ) ( )
'( ) ( )
0 3
1 3
1 0
13
1 0
3 2
13
3 2
704/19/23 15:32
UML
Calculating the Bezier Geometry Matrix
p c c c c c
p c
p c c c c
p p c
p p c c c
( )
( )
u u u u ukk
k
0 1 2
2
3
3
0
3
0 0
3 0 1 2 3
1 013 1
3 213 1 2 32 3
Inserting the four conditions gives:
804/19/23 15:32
UML
Calculating the Bezier Geometry Matrix
This gives four equations in four unknowns that
can be solved for :
where is the Bezier Geometry Matrix
c M p
M
M
B
B
B
1 0 0 0
3 3 0 0
3 6 3 0
1 3 3 1
904/19/23 15:32
UML
Bezier Blending Functions
p u M p
p b p
b M u
( )
( ) ( )
( )
u
u u
u
u u u
u u u
u u
u
T
B
T
B
T
1 3 3
3 6 3
3 3
2 3
2 3
2 3
3
where
This can be expressed:
1104/19/23 15:32
UML
Convex Hull Property:
p1
p0
p2
p3
b uii
0
3
1( )
Curve must lie withinthis region known as“convex hull” of thecontrol points.
1204/19/23 15:32
UML
Further look at the Bezier blending functions:
b( )
( )
( )
( )
( )!
!( )!( )
u
u
u u
u u
u
b ud
k d ku ukd
k d k
1
3 1
3 1
1
3
2
2
3
These are an instance of the Bernstein Polynomialsfor k=3.
Factoring the blending functions gives:
1404/19/23 15:32
UML
An interesting geometric construction
p0
0
p1
0p2
0
p3
0
p0
1
p1
1
p2
1
p0
2
p1
2
p0
3
p p p
p p
i
r
i
r
i
r
i i
u u u u ur ni n ru
( ) ( ) ( ) ( ),...,,...,
( )
1
10
1
1
1
0
1604/19/23 15:32
UML
Bezier surface patch
p00
p30
p03
p33
p p u M PM v( , ) ( ) ( )u v b u b vij o
j
i
i
j ij
T
B B
T
3
0
3
Convex hull of patch
1704/19/23 15:32
UML
Bezier surface patchCorner boundary conditions
p p
pp p
pp p
pp p p p
( , )
( , ) ( )
( , ) ( )
( , ) ( )
0 0
0 0 3
0 0 3
0 0 9
00
10 00
01 00
2
00 01 10 11
u
v
u v
Four equations for each corner gives 16 total.
Patch must interpolate the corner.
Defines derivative in u direction.
Defines derivative in v direction.
“Twist”
1804/19/23 15:32
UML
Rendering the Bezier patch by recursivesubdivision
First subdivide curves ofconstant v.
Connect new controlpoints to form newcurves.
Finally subdivide these curves to form 4 new patches.
2304/19/23 15:32
UML
Conversion between curve representations
Given a cubic Bezier curve expressed in terms of theBezier geometry matrix, MB:
The same curve can be expressed in terms of anotherpolynomial basis with matrix M and matrix of control
points q.
Solving for q gives:
q M M p 1
B
p u Mq( )u T
p u M p( )u T
B
2404/19/23 15:32
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 MI :
where
We want to find p such that:
p M M q M M
I B I B
1 156
32
13
13
32
56
1 0 0 0
3
3
0 0 0 1
where
q u M q( )u T
I M AI 1
q u M p( )u T
B
2504/19/23 15:32
UML
Drawing Bezier curves and surfaces:Evaluators
Evaluator
ControlPoints
ParameterGeneration
glMap1{fd}()glMap2{fd}()
glEvalCoord1{fd}()glEvalCoord2{fd}()
Parameter(s)
Curve/surfacevalue
Establish Evaluator:
Evaluate Points:
2604/19/23 15:32
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 valueu2: end parameter valuestride: number of values in each block of
control point storageorder: order of the Bezier curve (degree+1)*points: pointer to array of control points
2704/19/23 15:32
UML
One Dimensional Evaluators:target parameter
GL_MAP_VERTEX_3 x,y,z vertex coords.GL_MAP_VERTEX_4 x,y,z,w vertex coordsGL_MAP1_INDEX color indexGL_MAP1_COLOR_4 RGBAGL_MAP2_NORMAL normal coordinatesGL_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.
2904/19/23 15:32
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 beevaluated
3004/19/23 15:32
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 valueu2, v2: end parameter valuestride: number of values in each block of
control point storageorder: order of the Bezier curve (degree+1)*points: pointer to array of control points
3104/19/23 15:32
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 meshis to be evaluated