Title: Hermite ??? ??
19? ??? ??
2??
- ??? ??? ??
- ?? ???
- ?? ??? 3? ??? ??
- ???
- Hermite ??? ??
- Bezier ??? ??
- 3? B-???? (Cubic B-spline)
- ???? B-????
- ??? ??? ???
- Uta ????
- ?? ??
- OpenGL??? ??? ??
39.6 Bezier Curves and Surface
?? 9.16 ??? ??
49.6.1 Bezier Curves
Cubic Parametric polynomial
59.6.1 Bezier Curves
4?? control points P0 P1 P2 P3
????
69.6.1 Bezier Curves
CMBP, Bezier geometry matrix
79.6.1 Bezier Curves
where
89.6.1 Bezier Curves
99.6.1 Bezier Curves
Blending ??
d3? ??
These 4 polynomials are one case of the Bernstein
polynomial
109.6.1 Bezier Curves
(1)
By (1) (2), p(u) is a convex sum
(2)
11b3(u)
bo(u)
b2(u)
b1(u)
?? 9.17 Bezier ??? ?? ?? ???
12?? 9.18 convex hull? bezier ???
139.6.2 Bezier Surface Patches
?? 9,19 Bezier ?? ??
149.6.2 Bezier Surface Patches
4?4 array of control points
The corresponding Bezier Patch is
? ?? ???
15Consider the corner for uv0
Twist
16twist
?? 9,20 Bezier ?? ??? ????? ??
179.7 Cubic B-Spline
- Not require the polynomial to interpolate any of
these points
?? 9.21 ??? ? ?? ??? ??? ??? ???? ?? ? ?? ?
189.7.1 The Cubic B-spline Curve
?? 9.21 ??? ? ?? ??? ??? ??? ???? ?? ? ?? ?
199.7.1 The Cubic B-spline Curve
- C2 continuity at the join points with a cubic
- As u goes from 0 to 1, we span only the distance
between the middle two control points.
20(No Transcript)
21where
22Ms B-Spline Geometry Matrix
Blending function b(u)
23(1)
(2)
- C2 continuity. Smooth at the join points
- 3 times the work as compared with Bezier or
interpolating cubics
24?? 9,23 ???? ??? ?? ????
259.7.2 B-????? ????
?? ???? ????? ? ??? ? ??, ????
? ??? ??.
269.7.2 B-????? ????
??? ? ??? ???? ? ??? ?? ??? ???? ??
????? ??? ? ??.
?? 9.24 ???? ?? ??
279.7.3 ???? ??
?? 9.26 ???? ?? ??
289.8 ???? B-????
- M1 ?? ???? ??? ????. ???? ??
??? ?? ???? ???? ????, ?? ????
????? ??? ?? ? ?? ???. - ??? ?? ???(knot)??? ?? ??? ??
- ?????? ?? p(u)? ???? ??? d ? ?????
299.8.1 ????? ??? B-????
???? ?? ?????? ??? ???? ????? ???? ???.
???? ????? d ? ?????, ??? ????? 0 ??.
30Cox-deBoor ??? ??? ???? ???? ??
? ?? ???? ???, ?? ???? 0
? ?? ???? ???, ?? ???? 0
? ?? ???? ???, ?? ???? 0
d1 ?? ?? ? ?? d ??, ?? ???? 0
31- At the knots, there is Cd-1 continuity
- The Convex hull property holds because
and
- d-1 extra knot values the recursion requires
u0 and und to define spline from u0 and un1
?? 9.27 ?? ? ?? ?? ??
329.8.2 Uniform Splines
- Knot sequence 0,1,2, , n
- Between knots k and k1, we use the control
points - We have a curve defined for only the interval
u-1 and un-1.
339.8.2 Uniform Splines
?? 9.28 ?? B-????
34Periodic use the periodic nature of the control
point data to define the spline
?? 9.29 ???? ?? B-????
359.8.3 Nonuniform B-spline
- Open spline
- If a knots has multiplicity d1, the B-spline of
degree d must interpolate the points. - Ex) For cubic B-spline,
- 0,0,0,0,1,2,,, n-1,n,n,n,n
- One solution to the problem of the spline not
having sufficient data to span the desired
interval is to repeat knots at the ends.
369.8.4 NURBS
- Nonuniform rational B-spline curve
- Retain the properties such as Convex hull,
Continuity - Use the weights to increase / decrease the
importance of the particular control points. - It is handled correctly in perspective view.
379.9 Rendering of Curves and Surfaces
- Horners method n ?? /- and s
- If the points ui are uniformly spaced, we can
use the method of forward difference to evaluate
p(uk ) using O(n) /- and no s.
38If is constant, then we can
show that If p(u) is a polynomial of degree n,
is constant for all k
39?? 9.30 ?? ?? ?? ??
40?? 9.31 ?? ???? ??
419.9.2 Recursive Subdivision of Bezier Polynomials
- Rendering Methos based on Recursive Subdivision
- use of the convex hull
- never requires explicit evaluation of the
polynomial - We can break the curve into two separate poly
l(u), r(u) each valid over one-half of the
original interval. - l(u) traces the left half of p(u), and r(u) the
right half of p(u). - l(u) and r(u) has 4 control points l0, l1, l2,
l3 and r0, r1, r2, r3 - The convex hulls for l and r must lie inside the
convex hull for p (variation-diminishing property)
42?? 9.32 ??? ?? ????
- We can test the convex hull for flatness by
measuring the derivation of I1 and I2 from the
line segmant connecting I0 and I3. If they are
not close, we can divide l into two halves and
test the two new convex hull for flatness.
43?? 9.33 ?? ??? ??
449.9.3 Rendering of other Polynomial Curves by
Subdivision
- Consider a cubic Bezier curve
Where MB is the Bezier geometry Matrix
- The Efficiency of the Bezier subdivision
algorithm is such that we usually are better off
converting another curve form to Bezier form and
then using the subdivision
459.9.3 Rendering of other Polynomial Curves by
Subdivision
- The any polynomial can be written as
- For the conversion between cubic B-spline and
cubic Bezier curves, it is
469.9.4 Subdivision of Bezier Surfaces
?? 9.34 ?? Bezier ??
16 control points. Each 4 points in a row and
column
47?? 9.35 ? ?? ?? ?? ????
- First, we apply our curve-subdivision to the 4
curves determined by the 16 control points in the
u direction. - For each of u 0, 1/3, 2/3, 1, we create two
groups of 4 control points, with the middle point
shared by each group 7 points along
each original curve
48?? 9.36 ? ?? ?? ?? ????
- We now subdivide in the v direction using these
points. Consider the rows of constant v, where v
is one of 0, 1/3, 2/3, 1. There are 7 groups of 4
points - Each time creating two groups of 4 points, again
with the middle point shared. ?? 9.36
49?? 9.37 ??? ???
- Each quadrant contains 16 points that are the
control points for a subdivided Bezier surface. - ??? ???(flatness)? ???? ??? ??? ??? ?? ???. ???,
???? ?? subdivision? ??? ?? ??? ??.
509.10 The Utah Teapot
?? 9.38 ???? ???? ( A wire frame at 3
levels of subdivision)
519.10 The Utah Teapot
- An example of recursive subdivision of a set of
cubic Bezier patches - Created at the University of Utah by M. Newell
for testing various rendering algorithms - Used for 20 years in the graphics community
- consists of the control points for 32 bicubic
Bezier patches, 306 vertices. - - body (12 patches), handle (4 patches), spout (
4), lid (8), bottom (4)
52A simple Rendering with constant shading
53Void draw_patch(point p44) glBegin(GL_QUADS
) glvertex3fv(p00) glvertex3fv(p30)
glvertex3fv(p33) glvertex3fv(p03) glEn
d() Void divide_curve(point c4, point r4,
point l4) Int I Point t For (I0 Ilt3
I)
l2I(tI l1I )/2
l0Ic0I
r1I(tI r2I )/2 r3Ic3
I
l3Ir0I(l2Ir1I)/2 l1I(c1
Ic0I)/2
r2I(c2Ic3I)/2
tI(l1Ir1I)/2
54Void divide_patch(point p44, int n) Point
q44, r44, s44, t44 Point
a44, b44 Int I,j,k If (n0)
draw_patch(p) Else for (k0 klt4
k) divide_curve(pk, ak, bk)
transpose(a) transpose(b) for (k0
klt4 k) divide_curve(ak, qk,
rk) divide_curve(bk, sk, tk)
divide_patch(q, n-1) divide_patch(r, n-1)
divide_patch(s, n-1) divide_patch(t,
n-1)
559.12 Curves and Surfaces in OpenGL
- Evaluator compute values for the Bernstein
polynomials of any order - We can use evaluator one, two, three, and four
dimensional curves and surfaces. - We might use one dimensional curves to define
color maps or paths in time for animation. - GLU library to provide NURBS
569.12.1 Bezier Curves
- Bezier example program Bezier.exe
- glMap1f(GL_MAP1_VERTEX_3, // type of data
geberated - 0.0f
// lower u range - 100.f
// upper u range - 3, // distance
between points in the data, stride - nNumberPoints, // number of control
points, 4 - ctrlPoints00) // Array of control
points - GL_MAP1_VERTEX_3
- generates vertex coord triplet (x, y and z)
- GL_MAP1_VERTEX_4
- generates the coord and an alpha components
- Stride ? vertex? 3?? ???? ????? ? ???? 3??.
579.12.1 Bezier Curves
- glEnable(GL_MAP1_VERTEX_3)
- Enable the evaluator
- glEvalCoord1f( )
- Takes a single argument a parametric values
along the curve - This function then evaluates the curve at this
value and calls glVertex internally for that
points - By looping through the domain of the curve and
calling glEvalCoord to produce vertices. - glBegin (GL_LINE_STRIP)
- for(i0 I lt 100 I)
-
- glEvalCoord1f(I)
-
- glEnd()
58Evaluating a curve
- glMapGrid? glEvalMesh? ??
- glEvalCoord1f? ?? ??? ? ? ?? ??? ??.
- glMapGrid1d (100, 0.0, 100.0) tells OpenGL to
create an evenly spaced grid of points(100) over
the u domain (from 0.0 to 100.0) - glEvalMesh1(GL_LINE, 0,100) connect the dots
using the primitive specified(GL_LINE)
59A 3D Surface
- Create a Bezier Surface BEZ3D.EXE
- Creating a 3D Bezier surface is much like the 2D
version - glMap2f(GL_MAP2_VERTEX_3, // Type of data
generated - 0.0, // Lower u range
- 10.0 // Upper u range
- 3, // Distance between points
in the data, stride - 3, // Dimension in u direction
(order) - 0.0, // Lower v range
- 10.0, // Upper v range
- 9, // Distance between points
in the data, stride - 3, // Dimension in v direction
(order) - ctrlPoints000) // array of control
points
60A 3D Surface
- glEnable(GL_MAP2_VERTEX_3) Enable the evaluator
- glMapGrid2f(10, 0.0, 10.0, 0.0, 10.0)
- Map a grid of 10 points from 0 to 10 in u and
also in v - glEvalMesh2(GL_LINE, 0, 10, 0, 10)
- Evaluate the grid, using lines
61Lighting and Normal Vector
- BEZLIT.EXE ????
- glMapGrid2f(10, 0.0, 10.0, 0.0, 10.0)
- Map a grid of 10 points from 0 to 10 in u and
also in v - glEvalMesh2(GL_FILL, 0, 10, 0, 10)
- Evaluate the grid, using lines0
- glEnable(GL_AUTO_NORMAL)
629.12.3 NURBS functions
- Creating a NURBS Surface
- // NURBS object pointer
- GLUnurbsObj pNurb NULL
-
- // Setup the NURBS object
- pNurb gluNewNurbsRenderer()
-
63- NURBS Properties
- // Set sampling tolerance, ??? ???? Mesh? ????
???. - gluNurbsProperty(pNurb, GLU_SAMPLING_TOLERANCE,
25.0f) - // Fill to make a solid surface
- gluNurbsProperty(pNurb, GLU_DISPLAY_MODE,
(Glfloat)GLU_FILL) - Define the surface
- // Begin the NURB definition
// Done with
surface - gluBeginSurface(pNurb)
gluEndSurface(pNurb
) - // Evaluate the surface
- gluNurbsSurface(pNurb,
- 8, knots, // No. of knots
and knots array u direction - 8, knots, // No. of knots
and knots array v direction - 43, // Distance
between control points in u - 3, // Distance
between control points in v - ctrlpoints000, // Control points
- 4,4, // u and v
order of surface - GL_MAP2_VERTEX_3) // Type of surface, ???
?? ?? ?? (x,y,z)
64Trimming