Upload
alisher-buratov
View
228
Download
0
Embed Size (px)
Citation preview
8/2/2019 p07 Handout
1/35
Topics in Computer GraphicsChap 7: Polynomial Curve Constructions
fall, 2011
University of Seoul
School of Computer Science
Minho Kim
8/2/2019 p07 Handout
2/35
Table of contents
Aitkens Algorithm
Lagrange PolynomialsThe Vandermonde Approach
Limits of Lagrange Interpolation
Cubic Hermite Interpolation
Quintic Hermite Interpolation
Point-Normal Interpolation
Least Squares Approximation
Smoothing Equations
Designing with Bezier Curves
The Newton Form and Forward Differencing
8/2/2019 p07 Handout
3/35
Motivation
Given n points in 2D/3D, Interpolation: find a (polynomial) curve that passes through
the data exactly. Aitkens algorithm (7.1) Lagrange polynomials (7.2) The Vandermonde approach (7.3) The Newton form and forward differencing (7.11)
Approximation: find a (polynomial) curve that goes throughthe data closely in a reasonable way.
Least squares approximation (7.8) Smoothing equations (7.9)
Normal/tangent data in addition to position data. Cubic/quintic Hermite interpolation (7.5&7.6) Point-normal interpolation (7.7)
8/2/2019 p07 Handout
4/35
Outline
Aitkens Algorithm
Lagrange PolynomialsThe Vandermonde Approach
Limits of Lagrange Interpolation
Cubic Hermite Interpolation
Quintic Hermite Interpolation
Point-Normal Interpolation
Least Squares Approximation
Smoothing Equations
Designing with Bezier Curves
The Newton Form and Forward Differencing
8/2/2019 p07 Handout
5/35
Aitkens Algorithm
Problem: Given pointst pi u
ni
0
with corresponding
parameter values t ti un
i0
, find a curve p p tq such that
p p ti q pi, i 0, . . . , n .
8/2/2019 p07 Handout
6/35
Aitkens Algorithm (contd)
1. Base case: Let
p1
ip
tq
ti1 t
ti1 tip
i
t ti
ti1 tip
i 1, i
0, . . . , n
1.
p1i p t q is a line segment for ti t ti 1. p1i p t q interpolates pi and pi 1: p
1
i p ti q pi and
p
1
ip
ti 1 q
pi 1
.2. Let pn 1
0p tq is a polynomial of degree n 1 that
interpolates p0, . . . ,pn 1 and pn
1
1p
tq
is one that
interpolates p1, . . . ,pn.
3. Then
pn0 p tq tn t
tn t0pn 10
p tq t
t0
tn t0pn 11
p tq
is a polynomial curve of degree n and interpolates p0, . . . ,pn.
8/2/2019 p07 Handout
7/35
Aitkens Algorithm (contd)
With p0i p tq : pi, the interpolating curve pn0 p
tq
is defined
recursively as
pri p tq ti
r t
tir ti
pr 1i p tq t
ti
tir ti
pr 1i1
p tq ,
5
r 1, . . . , n
i 0, . . . , n r.
Properties
Affine invariance
Linear precision
No convex hull property
Is it possible for a smooth interpolating curve has a convex
hull property?
No variation diminishing property
Does not answer if such polynomial curve is unique.
Not a closed form
8/2/2019 p07 Handout
8/35
Outline
Aitkens Algorithm
Lagrange PolynomialsThe Vandermonde Approach
Limits of Lagrange Interpolation
Cubic Hermite Interpolation
Quintic Hermite Interpolation
Point-Normal Interpolation
Least Squares Approximation
Smoothing Equations
Designing with Bezier Curves
The Newton Form and Forward Differencing
8/2/2019 p07 Handout
9/35
Lagrange PolynomialsThe interpolating curve is given by
p p tq
n
i0
piLn
i
pt
q
where Lni p tq are Lagrange polynomialsdefined as
Ln
i
pt
q :
nj
0
j$i
pt
tj q
nj 0j
$i
p ti tj q
Lagrange polynomials are cardinal:
Lni p tj q i,j
where i,j is the Kronecker delta.
t Lni p tq uni
0
form a basis of all polynomials of degree n Interpolating polynomial (of degree n) is unique
n
i 0
Lni
p tq 1p tq
8/2/2019 p07 Handout
10/35
Outline
Aitkens Algorithm
Lagrange PolynomialsThe Vandermonde Approach
Limits of Lagrange Interpolation
Cubic Hermite Interpolation
Quintic Hermite Interpolation
Point-Normal Interpolation
Least Squares Approximation
Smoothing Equations
Designing with Bezier Curves
The Newton Form and Forward Differencing
8/2/2019 p07 Handout
11/35
The Vandermonde Approach
What is the monomial form
pn
p
tq
n
j0ajt
j
of the interpolating polynomial?
8/2/2019 p07 Handout
12/35
The Vandermonde Approach (contd)
1.
pnp
t0 q p0 a0 a1t0 antn0
pn p t1 q p1 a0 a1t1 antn1
...
pnp
tn q pn a0 a1tn antnn
2.
"
"
"
!
p0p1
...
pn
(
0
0
0
)
"
"
"
!
1 t0 tn0
1 t1 tn1
... ... . . . ...
1 tn tnn
(
0
0
0
)
"
"
"
!
a0a1
...
an
(
0
0
0
)
p
Ta
3. Ift
tj unj
0
are distinct, detT $ 0. (Why?)
detT is the Vandermonde of the interpolation problem
4. Solution: a T
1p
8/2/2019 p07 Handout
13/35
Generalized Vandermonde
For some basis t Fnj p tq unj
0
, (e.g. Bernstein basis) the
interpolating polynomial is expressed as
pnp
tq
n
j0
cjFnj p tq
and the coefficientstcj u
nj
0
can be found as
"
"
"
!
c1c2
...
cn
(
0
0
0
)
"
"
"
!
Fn0 p
t0 q Fn1 p
t0 q Fnn p t0 q
Fn0 p t1 q Fn1 p t1 q F
nn p t1 q
... ... . . . ...
Fn0 p
tn q Fn1 p
tn q Fnn p tn q
(
0
0
0
)
1
"
"
"
!
p0p1
...
pn
(
0
0
0
)
8/2/2019 p07 Handout
14/35
Outline
Aitkens Algorithm
Lagrange Polynomials
The Vandermonde Approach
Limits of Lagrange Interpolation
Cubic Hermite Interpolation
Quintic Hermite Interpolation
Point-Normal Interpolation
Least Squares Approximation
Smoothing Equations
Designing with Bezier Curves
The Newton Form and Forward Differencing
8/2/2019 p07 Handout
15/35
Limits of Lagrange Interpolation
Small change of input results in large change in output
The process is ill-conditioned. Polynomial interpolation is not shape preserving.
Runge phenomonen Expensive to solve
for construction (solving dense linear system) for evaluation (for high n)
Piecewise schemes are better! (e.g. spline interpolation)
O li
8/2/2019 p07 Handout
16/35
Outline
Aitkens Algorithm
Lagrange Polynomials
The Vandermonde Approach
Limits of Lagrange Interpolation
Cubic Hermite Interpolation
Quintic Hermite Interpolation
Point-Normal Interpolation
Least Squares Approximation
Smoothing Equations
Designing with Bezier Curves
The Newton Form and Forward Differencing
C bi H i I l i
8/2/2019 p07 Handout
17/35
Cubic Hermite Interpolation
Find the cubic polynomial that interpolates the following:
pp
0q
p0
E
3
9p p 0q m0 R3
9pp 1q m1 R
3
pp 1q p1 E
3,
Easier to work with Bezier form
p p tq
3
j 0
bjB3j p tq
1. b0 p0 and b3 p1
2. 9pp 0q 3b0 m0 and 9p p 1q 3b2 m1
b1 p0 1
3m0 and b2 b1
1
3m1
C bi H it I t l ti C di l F
8/2/2019 p07 Handout
18/35
Cubic Hermite Interpolation: Cardinal Form
pp tq p0B30 p tq
p0 13m0
B31 p tq
p1 13m1
B32 p tq p1B33 p tq
pp tq p0H30 p tq m0H
31 p tq m1H
32 p tq p1H
33 p tq
H30 p tq B30 p tq B
31 p tq
H31 p tq 1
3B31 p tq
H32 p tq 1
3B32 p tq
H33 p tq B32 p tq B
33 p tq
C bi H it I t l ti C di l F
8/2/2019 p07 Handout
19/35
Cubic Hermite Interpolation: Cardinal Form
H30 p 0q 1ddt
H30 p 0q 0ddt
H30 p 1q 0 H30 p 1q 0
H31 p 0q 0ddt
H31 p 0q 1ddt
H31 p 1q 0 H31 p 1q 0
H32 p 0q 0
ddt
H32 p 0q 0
ddt
H32 p 1q 1 H
32 p 1q 0
H33
p
0q
0ddtH
33
p
0q
0ddtH
33
p
1q
0 H33
p
1q
1
H30 p
tq
H33 p
tq 1p tq (Why?)
Not invariant under affine domain transformations
Not symmetric
O tline
8/2/2019 p07 Handout
20/35
Outline
Aitkens Algorithm
Lagrange Polynomials
The Vandermonde Approach
Limits of Lagrange Interpolation
Cubic Hermite Interpolation
Quintic Hermite Interpolation
Point-Normal Interpolation
Least Squares Approximation
Smoothing Equations
Designing with Bezier Curves
The Newton Form and Forward Differencing
Outline
8/2/2019 p07 Handout
21/35
Outline
Aitkens Algorithm
Lagrange Polynomials
The Vandermonde Approach
Limits of Lagrange Interpolation
Cubic Hermite Interpolation
Quintic Hermite Interpolation
Point-Normal Interpolation
Least Squares Approximation
Smoothing Equations
Designing with Bezier Curves
The Newton Form and Forward Differencing
Outline
8/2/2019 p07 Handout
22/35
Outline
Aitkens Algorithm
Lagrange Polynomials
The Vandermonde Approach
Limits of Lagrange Interpolation
Cubic Hermite Interpolation
Quintic Hermite Interpolation
Point-Normal Interpolation
Least Squares Approximation
Smoothing Equations
Designing with Bezier Curves
The Newton Form and Forward Differencing
Least Squares Approximation
8/2/2019 p07 Handout
23/35
Least Squares Approximation
P 1 number of data points can be interpolated by apolynomial of degree n if d P.
What if n
P?
approximation required
How to measure the closeness of the approximating curve
and the data points? least squares approximation: To find a polynomial curve
xp
tq
that minimizes
fp
c0, . . . , cnq
P
j 0x
p
tjq
pj2
.
Least Squares Approximation (contd)
8/2/2019 p07 Handout
24/35
Least Squares Approximation (cont d)
1. The approximating curve is expressed as
xp
tq
c0Cn0 p tq cnC
nn p tq
for some basist
Cnj unj
0
.
2. Assuming xp tq interpolates all the points t pj uPj 0, we get a
linear system
"
!
Cn0 p t0 q Cnn p t0 q...
. . ....
Cn0 p tP q Cnn p tP q
(
0
)
"
!
c0...
cn
(
0
)
"
!
p0...
pP
(
0
)
MC P
where
MR
pP
1
q pn
1
q ,C R p n 1q 3,P R p P 1q 3, P n
Linear systems for each component
underdetermined (no solution in general)
Least Squares Approximation (contd)
8/2/2019 p07 Handout
25/35
Least Squares Approximation (cont d)
3. Can be converted to a solvable linear system by
multiplying MT
:MTMC MTP
MTM is always invertible. (Why?) The solution minimizes
fp c0, . . . , cn q
P
j
0
xp tj q pj
2.
(Why?)
The solution satisfies
ff
fcdk
0, k
0, . . . , n , d
1, 2, 3.
Outline
8/2/2019 p07 Handout
26/35
Outline
Aitkens Algorithm
Lagrange Polynomials
The Vandermonde Approach
Limits of Lagrange Interpolation
Cubic Hermite Interpolation
Quintic Hermite Interpolation
Point-Normal Interpolation
Least Squares Approximation
Smoothing Equations
Designing with Bezier Curves
The Newton Form and Forward Differencing
Smoothing Equations
8/2/2019 p07 Handout
27/35
Smoothing Equations
Minimizing the least square error does not guarantee agood curve. (Fig 7.8)
We want a curve that does not wiggle much. (How?)
If the control polygon behaves nicely, then so does the
curve.
How to minimizes wiggling (of the polygon)?
minimize
the 2nd differences 2bi
b0 2b1 b2 0...
bn 2 2bn 1 bn 0
SB
0
Smoothing Equations (contd)
8/2/2019 p07 Handout
28/35
Smoothing Equations (cont d)
Combined with the least squares problem,
M
S
&
B
P
0
&
Balancing the error and shape
p 1 q M
S
&
B
p 1 q P
0
&
0 1
Larger for noisier data
Outline
8/2/2019 p07 Handout
29/35
Outline
Aitkens Algorithm
Lagrange Polynomials
The Vandermonde Approach
Limits of Lagrange Interpolation
Cubic Hermite Interpolation
Quintic Hermite Interpolation
Point-Normal Interpolation
Least Squares Approximation
Smoothing Equations
Designing with Bezier Curves
The Newton Form and Forward Differencing
Designing with Bezier Curves
8/2/2019 p07 Handout
30/35
Designing with Bezier Curves
What if we want to move a point on the curve to change
the shape?
Given a Bezier curve
xp tq
n
i0
biBni p tq ,
if we change a point xp
tq
to y, how should we changetbi u
to t bi u such that the curve passes through y at t t?
y
n
i0
biBn
i
pt
q
Assume b0 and bn are unchanged. Underdetermined: 1 equation and n 1 unknowns
Designing with Bezier Curves (contd)
8/2/2019 p07 Handout
31/35
Designing with Bezier Curves (cont d)
1.
Bn1 p tq Bnn 1 p tq$
"
!
b1
...
bn 1
(
0
)
y b0Bn0 p tq bnBnn p tq : z
AB
z
2. Assume all the points b1, . . . ,bn1 move along (unknown)
c direction:
B B ATc AB AB AATc z AB AATc
3. Since AAT is a scalar, with a : AAT
c
1
apy
x
q B
B
1
aAT
py
x
q.
Outline
8/2/2019 p07 Handout
32/35
Aitkens Algorithm
Lagrange Polynomials
The Vandermonde Approach
Limits of Lagrange Interpolation
Cubic Hermite Interpolation
Quintic Hermite Interpolation
Point-Normal Interpolation
Least Squares Approximation
Smoothing Equations
Designing with Bezier Curves
The Newton Form and Forward Differencing
The Newton Form of Interpolating Polynomial
8/2/2019 p07 Handout
33/35
p g y For equally spaced parameter intervals: ti 1 ti h
For cubic case,
pp
tq
p0 1h
pt
t0 q p0 1
2!h2p
t
t0 q p t t1 q 2p0
1
3!h3p t t0 q p t t1 q p t t2 q
3p0
where
ipj :
i1pj
1
i1pj and
0pj pj .
With g : 1{ h,
p0
p1 gp0
p2 gp1 g22p0
p3 gp2 g22p1 g
33p0
Fast Evaluation for Plotting
8/2/2019 p07 Handout
34/35
g Efficient way to evaluate p
pt2 hq ,p p t2 2hq , . . .
p0
p1 gp0
p2 gp1 g
22
p0p3 gp2 g
22p1 g33p0
p4 gp3 g22p2 g
33p1
p5 gp4 g22p3 g
33p2
.
.
....
.
.
....
t g3pj u are all equal. (Why?) From right to left
g22p2 g33p1 g
22p1 gp3 g
22p2 gp2
p4 gp3 p3
In general, with qij : giipj ,
qij qi
1
j1
qij1, i 2, 1, 0
and pj
q0
j .
Fast for Plotting (contd)
8/2/2019 p07 Handout
35/35
g ( )
No multiplication involved! (after start-up phase)
extremely fast
Given a polynomial in cubic Bezier form,
1. Compute initial four points.2. Evaluate sequence of points and plot using line segments.
Roundoff error is accumulated The curve may deviates
more and more...