pramook@gmail.com - PowerPoint PPT Presentation

About This Presentation
Title:

pramook@gmail.com

Description:

Title: CS 445 / 645 Introduction to Computer Graphics Author: Dave Last modified by: Office Of Computer Services Created Date: 9/26/2002 6:03:03 PM – PowerPoint PPT presentation

Number of Views:103
Avg rating:3.0/5.0
Slides: 129
Provided by: Dave1325
Category:

less

Transcript and Presenter's Notes

Title: pramook@gmail.com


1
418382 ??????????????????????????????????????????
????????????? 7
  • pramook_at_gmail.com

2
(No Transcript)
3
(No Transcript)
4
(No Transcript)
5
(No Transcript)
6
(No Transcript)
7
(No Transcript)
8
(No Transcript)
9
(No Transcript)
10
(No Transcript)
11
(No Transcript)
12
(No Transcript)
13
(No Transcript)
14
(No Transcript)
15
(No Transcript)
16
(No Transcript)
17
(No Transcript)
18
(No Transcript)
19
(No Transcript)
20
(No Transcript)
21
(No Transcript)
22
CS 445 / 645Introduction to Computer Graphics
  • Lecture 22
  • Hermite Splines

23
Splines Old School
Duck
Spline
24
Representations of Curves
  • Use a sequence of points
  • Piecewise linear - does not accurately model a
    smooth line
  • Tedious to create list of points
  • Expensive to manipulate curve because all points
    must be repositioned
  • Instead, model curve as piecewise-polynomial
  • x x(t), y y(t), z z(t)
  • where x(), y(), z() are polynomials

25
Specifying Curves (hyperlink)
  • Control Points
  • A set of points that influence the curves shape
  • Knots
  • Control points that lie on the curve
  • Interpolating Splines
  • Curves that pass through the control points
    (knots)
  • Approximating Splines
  • Control points merely influence shape

26
Parametric Curves
  • Very flexible representation
  • They are not required to be functions
  • They can be multivalued with respect to any
    dimension

27
Cubic Polynomials
  • x(t) axt3 bxt2 cxt dx
  • Similarly for y(t) and z(t)
  • Let t (0 lt t lt 1)
  • Let T t3 t2 t 1
  • Coefficient Matrix C
  • Curve Q(t) TC

28
Piecewise Curve Segments
  • One curve constructed by connecting many smaller
    segments end-to-end
  • Must have rules for how the segments are joined
  • Continuity describes the joint
  • Parametric continuity
  • Geometric continuity

29
Parametric Continuity
  • C1 is tangent continuity (velocity)
  • C2 is 2nd derivative continuity (acceleration)
  • Matching direction and magnitude of dn / dtn
  • Cn continous

30
Geometric Continuity
  • If positions match
  • G0 geometric continuity
  • If direction (but not necessarily magnitude) of
    tangent matches
  • G1 geometric continuity
  • The tangent value at the end of one curve is
    proportional to the tangent value of the
    beginning of the next curve

31
Parametric Cubic Curves
  • In order to assure C2 continuity, curves must be
    of at least degree 3
  • Here is the parametric definition of a cubic
    (degree 3) spline in two dimensions
  • How do we extend it to three dimensions?

32
Parametric Cubic Splines
  • Can represent this as a matrix too

33
Coefficients
  • So how do we select the coefficients?
  • ax bx cx dx and ay by cy dy must satisfy the
    constraints defined by the knots and the
    continuity conditions

34
Parametric Curves
  • Difficult to conceptualize curve as x(t) axt3
    bxt2 cxt dx(artists dont think in terms
    of coefficients of cubics)
  • Instead, define curve as weighted combination of
    4 well-defined cubic polynomials(wait a second!
    Artists dont think this way either!)
  • Each curve type defines different cubic
    polynomials and weighting schemes

35
Parametric Curves
  • Hermite two endpoints and two endpoint tangent
    vectors
  • Bezier - two endpoints and two other points that
    define the endpoint tangent vectors
  • Splines four control points
  • C1 and C2 continuity at the join points
  • Come close to their control points, but not
    guaranteed to touch them
  • Examples of Splines

36
Hermite Cubic Splines
  • An example of knot and continuity constraints

37
Hermite Cubic Splines
  • One cubic curve for each dimension
  • A curve constrained to x/y-plane has two curves

38
Hermite Cubic Splines
  • A 2-D Hermite Cubic Spline is defined by eight
    parameters a, b, c, d, e, f, g, h
  • How do we convert the intuitive endpoint
    constraints into these (relatively) unintuitive
    eight parameters?
  • We know
  • (x, y) position at t 0, p1
  • (x, y) position at t 1, p2
  • (x, y) derivative at t 0, dp/dt
  • (x, y) derivative at t 1, dp/dt

39
Hermite Cubic Spline
  • We know
  • (x, y) position at t 0, p1

40
Hermite Cubic Spline
  • We know
  • (x, y) position at t 1, p2

41
Hermite Cubic Splines
  • So far we have four equations, but we have eight
    unknowns
  • Use the derivatives

42
Hermite Cubic Spline
  • We know
  • (x, y) derivative at t 0, dp/dt

43
Hermite Cubic Spline
  • We know
  • (x, y) derivative at t 1, dp/dt

44
Hermite Specification
  • Matrix equation for Hermite Curve

t3 t2 t1 t0
t 0
p1
t 1
p2
t 0
r p1
r p2
t 1
45
Solve Hermite Matrix
46
Spline and Geometry Matrices
MHermite
GHermite
47
Resulting Hermite Spline Equation
48
Sample Hermite Curves
49
Blending Functions
  • By multiplying first two matrices in lower-left
    equation, you have four functions of t that
    blend the four control parameters
  • These are blendingfunctions

50
Hermite Blending Functions
  • If you plot the blending functions on the
    parameter t

51
Hermite Blending Functions
  • Remember, eachblending functionreflects
    influenceof P1, P2, DP1, DP2on splines shape

52
CS 445 / 645Introduction to Computer Graphics
  • Lecture 23
  • Bézier Curves

53
Splines - History
  • Draftsman use ducks and strips of wood
    (splines) to draw curves
  • Wood splines have second-order continuity
  • And pass through the control points

A Duck (weight)
Ducks trace out curve
54
Bézier Curves
  • Similar to Hermite, but more intuitive definition
    of endpoint derivatives
  • Four control points, two of which are knots

55
Bézier Curves
  • The derivative values of the Bezier Curve at the
    knots are dependent on the adjacent points
  • The scalar 3 was selected just for this curve

56
Bézier vs. Hermite
  • We can write our Bezier in terms of Hermite
  • Note this is just matrix form of previous
    equations

57
Bézier vs. Hermite
  • Now substitute this in for previous Hermite

MBezier
58
Bézier Basis and Geometry Matrices
  • Matrix Form
  • But why is MBezier a good basis matrix?

59
Bézier Blending Functions
  • Look at the blending functions
  • This family of polynomials is calledorder-3
    Bernstein Polynomials
  • C(3, k) tk (1-t)3-k 0lt k lt 3
  • They are all positive in interval 0,1
  • Their sum is equal to 1

60
Bézier Blending Functions
  • Thus, every point on curve is linear combination
    of the control points
  • The weights of the combination are all positive
  • The sum of the weights is 1
  • Therefore, the curve is a convex combination of
    the control points

61
Convex combination of control points
  • Will always remain within bounding region (convex
    hull) defined by control points

62
(No Transcript)
63
(No Transcript)
64
(No Transcript)
65
(No Transcript)
66
Why more spline slides?
  • Bezier and Hermite splines have global influence
  • One could create a Bezier curve that required 15
    points to define the curve
  • Moving any one control point would affect the
    entire curve
  • Piecewise Bezier or Hermite dont suffer from
    this, but they dont enforce derivative
    continuity at join points
  • B-splines consist of curve segments whose
    polynomial coefficients depend on just a few
    control points
  • Local control
  • Examples of Splines

67
B-Spline Curve (cubic periodic)
  • Start with a sequence of control points
  • Select four from middle of sequence (pi-2, pi-1,
    pi, pi1) d
  • Bezier and Hermite goes between pi-2 and pi1
  • B-Spline doesnt interpolate (touch) any of them
    but approximates going through pi-1 and pi

p2
p6
p1
Q4
Q5
t4
t5
Q3
Q6
t6
p3
t3
t7
p0
p4
p5
68
Uniform B-Splines
  • Approximating Splines
  • Approximates n1 control points
  • P0, P1, , Pn, n 3
  • Curve consists of n 2 cubic polynomial segments
  • Q3, Q4, Qn
  • t varies along B-spline as Qi ti lt t lt ti1
  • ti (i integer) are knot points that join
    segment Qi to Qi1
  • Curve is uniform because knots are spaced at
    equal intervals of parameter, t

69
Uniform B-Splines
  • First curve segment, Q3, is defined by first four
    control points
  • Last curve segment, Qm, is defined by last four
    control points, Pm-3, Pm-2, Pm-1, Pm
  • Each control point affects four curve segments

70
B-spline Basis Matrix
  • Formulate 16 equations to solve the 16 unknowns
  • The 16 equations enforce the C0, C1, and C2
    continuity between adjoining segments, Q

71
B-Spline
  • Points along B-Spline are computed just as with
    Bezier Curves

72
B-Spline
  • By far the most popular spline used
  • C0, C1, and C2 continuous

73
Nonuniform, Rational B-Splines(NURBS)
  • The native geometry element in Maya
  • Models are composed of surfaces defined by NURBS,
    not polygons
  • NURBS are smooth
  • NURBS require effort to make non-smooth

74
Converting Between Splines
  • Consider two spline basis formulations for two
    spline types

75
Converting Between Splines
  • We can transform the control points from one
    spline basis to another

76
Converting Between Splines
  • With this conversion, we can convert a B-Spline
    into a Bezier Spline
  • Bezier Splines are easy to render

77
Rendering Splines
  • Horners Method
  • Incremental (Forward Difference) Method
  • Subdivision Methods

78
Horners Method
  • Three multiplications
  • Three additions

79
Forward Difference
  • But this still is expensive to compute
  • Solve for change at k (Dk) and change at k1
    (Dk1)
  • Boot strap with initial values for x0, D0, and D1
  • Compute x3 by adding x0 D0 D1

80
Subdivision Methods
  • Bezier

81
Rendering Bezier Spline
public void spline(ControlPoint p0,
ControlPoint p1,
ControlPoint p2, ControlPoint p3, int pix)
float len ControlPoint.dist(p0,p
1) ControlPoint.dist(p1,p2)
ControlPoint.dist(p2,p3)
float chord ControlPoint.dist(p0,p3)
if (Math.abs(len - chord) lt 0.25f)
return fatPixel(pix, p0.x, p0.y)
ControlPoint p11
ControlPoint.midpoint(p0, p1)
ControlPoint tmp ControlPoint.midpoint(p1,
p2) ControlPoint p12
ControlPoint.midpoint(p11, tmp)
ControlPoint p22 ControlPoint.midpoint(p2,
p3) ControlPoint p21
ControlPoint.midpoint(p22, tmp)
ControlPoint p20 ControlPoint.midpoint(p12,
p21) spline(p20, p12, p11, p0,
pix) spline(p3, p22, p21, p20,
pix)
82
(No Transcript)
83
(No Transcript)
84
(No Transcript)
85
(No Transcript)
86
(No Transcript)
87
(No Transcript)
88
(No Transcript)
89
(No Transcript)
90
(No Transcript)
91
(No Transcript)
92
(No Transcript)
93
(No Transcript)
94
(No Transcript)
95
(No Transcript)
96
(No Transcript)
97
(No Transcript)
98
(No Transcript)
99
(No Transcript)
100
(No Transcript)
101
(No Transcript)
102
(No Transcript)
103
(No Transcript)
104
(No Transcript)
105
(No Transcript)
106
(No Transcript)
107
(No Transcript)
108
(No Transcript)
109
(No Transcript)
110
(No Transcript)
111
(No Transcript)
112
(No Transcript)
113
(No Transcript)
114
(No Transcript)
115
(No Transcript)
116
(No Transcript)
117
???????????
  • ??????????????????????????????? ? ?????? (x,y,z)
    ???
  • ???????? (x,y,z) ??????????????????????????

118
????????
  • ??????????????????????????????????? 60 ??????????
    (1,1,1)
  • ???????????????????????????
  • ???????? cos ??? sin
  • ?????????????????????????

119
????????
  • ???????????????????????????????????? ???????????
  • ?????????
  • ??????
  • ????????????????

120
?????????????????
  • ???????????????????????????????
  • ?????????????????????????????????????
  • ??????????????????????????????????????????????????
    ?

121
????????
  • ???
  • ???????

122
????????
  • q1 ????????????????? 90 ???? ?????? (3/5, 0, 4/5)
  • q2 ????????????????? 60 ???? ?????? (3/5, 0, 4/5)
  • ?????? q1q2 ????????????????? 60 ???????????????
    90 ????
  • ?????????????????? 150 ?????????? (3/5, 0, 4/5)
  • ??????

123
Slerp
  • ????????? slerp ?????????????
  • ?????????????????? slerp(q0,q1,?) ????????? ?
    ????????????????????? ??? 0 ??? 1 ?????? plot
    quaternion ???????? ???????????
    ????????????????????????????????? geodesic
    ??????????????????? 4 ???????????????????????? q0
    ??? q1
  • ??? ? ??????????????????????? geodesic ???
    ????????
  • ??? ? 0 ????????? q0
  • ??? ? 1 ????????? q1
  • ??? ? 0.5 ???????????????????? q0 ??? q1 ????
  • ???

124
Slerp
125
????????
  • ???
  • ???????

126
????????
  • ????????? x component ??? z component ???? 0
  • ????????????????? x ??? z ????????????????? 0
    ???? ????????????? geodesic ?????????????????? x
    ??? z ??????? 0 (??????????????????????)
  • ?????????????????????????? geodesic
    ??????????????????????? 2 ???? ???????????????????
    ??????????????? w ?????? y

127
????????
  • ?????????? q0 ??? q1 ??? 90 ????
  • slerp(q0,q1,1/3) ????????????????????? q0 ????
    1/3 ?????????? 90 ???? ????????????? 30 ???????
    q0
  • ?????? slerp(q0,q1,1/3) ?????????? (w,y) ???????
  • ????????

128
????????
y
q1
2/3
slerp(q0,q1,1/3)
1/3
w
q0
Write a Comment
User Comments (0)
About PowerShow.com