+ All Categories
Home > Documents > Linear Methods for Degree Reduction of Bézier Curves with ...

Linear Methods for Degree Reduction of Bézier Curves with ...

Date post: 02-Jan-2017
Category:
Upload: phungdiep
View: 217 times
Download: 0 times
Share this document with a friend
39
Linear Methods for Degree Reduction of ezier Curves with Geometric Continuity Stephen Mann and Abdallah Rababah Degree 19 vs 8 Least squares approximations Ends of curve (parametric vs geometric continuity) Linear vs non-linear solutions
Transcript
Page 1: Linear Methods for Degree Reduction of Bézier Curves with ...

Linear Methods for Degree Reduction of

Bezier Curves with Geometric Continuity

Stephen Mann and Abdallah Rababah

Degree 19 vs 8

• Least squares approximations

• Ends of curve (parametricvs geometric continuity)

• Linear vs non-linear solutions

Page 2: Linear Methods for Degree Reduction of Bézier Curves with ...

Degree Reduction with Least Squares

• Want to minimize ∫ 1

0||BnPn −BmQm||2dt

Qi are variables to minimize, m < n

∂Qk

∫ 1

0||BnPn −BmQm||2dt

= −2∫ 1

0(BnPn −BmQm)Bmk dt

= −2(∑∫ 1

0Bmk B

ni Pidt−

∑∫ 1

0Bmk B

mj Qjdt)

= −2(∑

mk,iPi −∑

m′k,jQj)

Page 3: Linear Methods for Degree Reduction of Bézier Curves with ...

Degree Reduction with Least Squares

• Want to minimize ∫ 1

0||BnPn −BmQm||2dt

Qi are variables to minimize, m < n

∂Qk

∫ 1

0||BnPn −BmQm||2dt

= −2∫ 1

0(BnPn −BmQm)Bmk dt

= −2(∑∫ 1

0Bmk B

ni Pidt−

∑∫ 1

0Bmk B

mj Qjdt)

= −2(∑

mk,iPi −∑

m′k,jQj)

Page 4: Linear Methods for Degree Reduction of Bézier Curves with ...

Degree Reduction with Least Squares

• Want to minimize ∫ 1

0||BnPn −BmQm||2dt

Qi are variables to minimize, m < n

∂Qk

∫ 1

0||BnPn −BmQm||2dt

= −2∫ 1

0(BnPn −BmQm)Bmk dt

= −2(∑∫ 1

0Bmk B

ni Pidt−

∑∫ 1

0Bmk B

mj Qjdt)

= −2(∑

mk,iPi −∑

m′k,jQj)

Page 5: Linear Methods for Degree Reduction of Bézier Curves with ...

Degree Reduction with Least Squares

• Want to minimize ∫ 1

0||BnPn −BmQm||2dt

Qi are variables to minimize, m < n

∂Qk

∫ 1

0||BnPn −BmQm||2dt

= −2∫ 1

0(BnPn −BmQm)Bmk dt

= −2(∑∫ 1

0Bmk B

ni Pidt−

∑∫ 1

0Bmk B

mj Qjdt)

= −2(∑

mk,iPi −∑

m′k,jQj)

Page 6: Linear Methods for Degree Reduction of Bézier Curves with ...

Degree Reduction with Least Squares

• Want to minimize ∫ 1

0||BnPn −BmQm||2dt

Qi are variables to minimize, m < n

∂Qk

∫ 1

0||BnPn −BmQm||2dt

= −2∫ 1

0(BnPn −BmQm)Bmk dt

= −2(∑∫ 1

0Bmk B

ni Pidt−

∑∫ 1

0Bmk B

mj Qjdt)

= −2(∑

mk,iPi −∑

m′k,jQj)∫ 10 B

mi (t)Bnj (t)dt =

(mi )(nj)

(m+n+1)(m+ni+j )

= mi,j

Page 7: Linear Methods for Degree Reduction of Bézier Curves with ...

Degree Reduction with Least Squares

• Want to minimize ∫ 1

0||BnPn −BmQm||2dt

Qi are variables to minimize, m < n

∂Qk

∫ 1

0||BnPn −BmQm||2dt

= −2∫ 1

0(BnPn −BmQm)Bmk dt

= −2(∑∫ 1

0Bmk B

ni Pidt−

∑∫ 1

0Bmk B

mj Qjdt)

= −2(∑

mk,iPi −∑

m′k,jQj)

Page 8: Linear Methods for Degree Reduction of Bézier Curves with ...

Least Squares Solution

• We have m+ 1 equations of the form

−2(∑

mk,iPi −∑

m′k,jQj)

• Gather into matrices of m+ 1 control points, etc., and set to 0:

0 = (MmnP −MmmQ)

Q = M−1mmMmnP

• Bonus: Mmm is positive definite

• Extra bonus: Qjs are multivariate, but only need (m+ 1)× (m+ 1)system

and not d(m+ 1)× d(m+ 1) system

Page 9: Linear Methods for Degree Reduction of Bézier Curves with ...

Least Squares Solution

• We have m+ 1 equations of the form

−2(∑

mk,iPi −∑

m′k,jQj)

• Gather into matrices of m+ 1 control points, etc., and set to 0:

0 = (MmnP −MmmQ)

Q = M−1mmMmnP

• Bonus: Mmm is positive definite

• Extra bonus: Qjs are multivariate, but only need (m+ 1)× (m+ 1)system

and not d(m+ 1)× d(m+ 1) system

Page 10: Linear Methods for Degree Reduction of Bézier Curves with ...

Least Squares Solution

• We have m+ 1 equations of the form

−2(∑

mk,iPi −∑

m′k,jQj)

• Gather into matrices of m+ 1 control points, etc., and set to 0:

0 = (MmnP −MmmQ)

Q = M−1mmMmnP

• Bonus: Mmm is positive definite

• Extra bonus: Qjs are multivariate,

but only need (m+ 1)× (m+ 1) system

and not d(m+ 1)× d(m+ 1) system

(i.e., do not have to expand into coordinates)

Page 11: Linear Methods for Degree Reduction of Bézier Curves with ...

Least Squares Solution

• We have m+ 1 equations of the form

−2(∑

mk,iPi −∑

m′k,jQj)

• Gather into matrices of m+ 1 control points, etc., and set to 0:

0 = (MmnP −MmmQ)

Q = M−1mmMmnP

• Bonus: Mmm is positive definite

• Extra bonus: Qjs are multivariate,

suggest d(m+ 1)× d(m+ 1) system

but only need (m+ 1)× (m+ 1) system

(i.e., do not have to expand into coordinates)

Page 12: Linear Methods for Degree Reduction of Bézier Curves with ...

Examples

Degree 10 curve (from Lu-Wang paper)

Degree 3 Degree 4

Page 13: Linear Methods for Degree Reduction of Bézier Curves with ...

Examples

Degree 10 curve (from Lu-Wang paper)

Degree 3 Degree 4

Page 14: Linear Methods for Degree Reduction of Bézier Curves with ...

Continuity At Ends

• C0: Q0 = P0, Qm = Pn

• C1: Q1 = P0 + nm(P1 − P0), Qm−1 = Pn − n

m(Pn − Pn−1)

• Ck: (first k + 1 CPs), (last k + 1 CPs)

• Each level of continuity removes two variables,

and two fewer equations

Page 15: Linear Methods for Degree Reduction of Bézier Curves with ...

Ck Solutions

• Equation changes to

0 = (MmnP −MmmQ) = (MmnP −McmmQ

c −MfmmQ

f)

where

– Qc are end points (set by continuity)

– Qf are free points

Mcmm,Mf

mm submatrices of Mmm

• Solution:

Qf = (Mfmm)−1(MmnP −Mc

mmQc)

Page 16: Linear Methods for Degree Reduction of Bézier Curves with ...

Ck Solutions

• Equation changes to

0 = (MmnP −MmmQ) = (MmnP −McmmQ

c −MfmmQ

f)

where

– Qc are end points (set by continuity)

– Qf are free points

Mcmm,Mf

mm submatrices of Mmm

• Solution:

Qf = (Mfmm)−1(MmnP −Mc

mmQc)

Page 17: Linear Methods for Degree Reduction of Bézier Curves with ...

C0, C1 Example

degree 4 C0, degree 4 C1, degree 4

Page 18: Linear Methods for Degree Reduction of Bézier Curves with ...

Geometric Continuity

• Parametric continuity: equal derivatives

• If only care about geometry, then use geometric continuity

– G1: equal tangent lines

Q1 = P0 + δ0nm(P1 − P0)

Qm−1 = Pn − δ1nm(Pn − Pn−1)

δ0, δ1 > 0

– G2: equal curvature

Q2 = 2Q1 −Q0 +n(n− 1)

m(m− 1)δ2

0∆P20 +

n

m(m− 1)η0∆P0

Qm−2 = 2Qm−1 −Qm +n(n− 1)

m(m− 1)δ2

1∆P2m−2 +

n

m(m− 1)η1∆Pm−1

where ∆s are differences of control points

Page 19: Linear Methods for Degree Reduction of Bézier Curves with ...

Lu-Wang G1

• Didn’t like δ0, δ1 > 0 constraint, so rewrote to

Q1 = P0 + δ20nm(P1 − P0)

Qm−1 = Pn − δ21nm(Pn − Pn−1)

• Iterative method:

1. Set delta0=delta1=1

2. Solve for Qs as for C1

3. Use Qs to solve for deltas

Quartic equations

4. Goto 2

• Extra condition to avoid δi = 0 or even δi small

∫ 10 ||BnPn −BmQm||2dt

Page 20: Linear Methods for Degree Reduction of Bézier Curves with ...

Lu-Wang G2

• Modified G1 equations change G2 equations to

Q2 = 2Q1 −Q0 +n(n− 1)

m(m− 1)δ4

0∆P20 +

n

m(m− 1)η0∆P0

Qm−2 = 2Qm−1 −Qm +n(n− 1)

m(m− 1)δ4

1∆P2m−2 +

n

m(m− 1)η1∆Pm−1

• Iterative method:

1. Set delta0=delta1=1, eta0=eta1=0

2. Solve for Qs as for C2

3. Use Qs to solve for deltas, etas

Degree 8 equations

4. Goto 2

• Extra condition to avoid δi = 0 or even δi small

∫ 10 ||BnPn −BmQm||2dt

Page 21: Linear Methods for Degree Reduction of Bézier Curves with ...

Linear G1 Method

• Observation: if you use original G1 equations,then δis linear in equations

Q1 = P0 + δ0nm(P1 − P0)

Qm−1 = Pn − δ1nm(Pn − Pn−1)

• Take derivatives w.r.t. Qk, δi

∫ 1

0||BnPn −BmQm||2dt

• Single system of equations linear in Qks, δis

− Have to expand Qk equations into coordinates

− Deal with δi < 0 cases

Page 22: Linear Methods for Degree Reduction of Bézier Curves with ...

Linear G1 Method

• Observation: if you use original G1 equations,then δis linear in equations

Q1 = P0 + δ0nm(P1 − P0)

Qm−1 = Pn − δ1nm(Pn − Pn−1)

• Take derivatives w.r.t. Qk, δi

∫ 1

0||BnPn −BmQm||2dt

• Single system of equations linear in Qks, δis (no iteration)

− Have to expand Qk equations into coordinates

− Deal with δi < 0 cases

Page 23: Linear Methods for Degree Reduction of Bézier Curves with ...

δi < 0

When δi < 0,

• New system of equations with δi = ε

ε related to minimum acceptable length of tangent

• Resolve new system of equations

• Possibly have to solve 3 times

• If both δi set to minimum, then C1 solution

Page 24: Linear Methods for Degree Reduction of Bézier Curves with ...

G1 Example

Black: Degree 10 curve

Red: C1 quartic (L2 0.60)

Green: G1 quartic (L2 0.44)

Page 25: Linear Methods for Degree Reduction of Bézier Curves with ...

Linear G2, G3 Methods

• G2 equations quadratic in δs:

Q2 = 2Q1 −Q0 +n(n− 1)

m(m− 1)δ2

0∆P20 +

n

m(m− 1)η0∆P0

• Instead, make C1/G2 by fixing δis to be 1

Q2 = 2Q1 −Q0 +n(n− 1)

m(m− 1)∆P2

0 +n

m(m− 1)η0∆P0

Now equations are linear in ηs

Don’t have to worry about δ < 0

Linear system to find C1/G2 approximation

• For G3, setting δi = 1 leads to linear systems with four unknowns

Q3 = 3Q2 − 3Q1 +Q0 +1

m(m− 1)(m− 2)[n∆p0ζ0 +

3n(n− 1)∆2p0η0 + n(n− 1)(n− 2)∆3p0]

Page 26: Linear Methods for Degree Reduction of Bézier Curves with ...

Linear G2, G3 Methods

• G2 equations quadratic in δs:

Q2 = 2Q1 −Q0 +n(n− 1)

m(m− 1)δ2

0∆P20 +

n

m(m− 1)η0∆P0

• Instead, make C1/G2 by fixing δis to be 1

Q2 = 2Q1 −Q0 +n(n− 1)

m(m− 1)∆P2

0 +n

m(m− 1)η0∆P0

Now equations are linear in ηs

• For G3, setting δi = 1 leads to linear systems with four unknowns

Q3 = 3Q2 − 3Q1 +Q0 +1

m(m− 1)(m− 2)[n∆p0ζ0 +

3n(n− 1)∆2p0η0 + n(n− 1)(n− 2)∆3p0]

(Lu-Wang approach would require solving system of degree 12equations)

Page 27: Linear Methods for Degree Reduction of Bézier Curves with ...

Linear G2, G3 Methods

• G2 equations quadratic in δs:

Q2 = 2Q1 −Q0 +n(n− 1)

m(m− 1)δ2

0∆P20 +

n

m(m− 1)η0∆P0

• Instead, make C1/G2 by fixing δis to be 1

Q2 = 2Q1 −Q0 +n(n− 1)

m(m− 1)∆P2

0 +n

m(m− 1)η0∆P0

Now equations are linear in ηs

• For G3, setting δi = 1 leads to linear systems with four unknowns

Q3 = 3Q2 − 3Q1 +Q0 +1

m(m− 1)(m− 2)[n∆p0ζ0 +

3n(n− 1)∆2p0η0 + n(n− 1)(n− 2)∆3p0]

(Lu-Wang approach would require solving system of degree 12equations)

Page 28: Linear Methods for Degree Reduction of Bézier Curves with ...

Lu-Wang Example

Black: Degree 10 curveRed: C2 degree 6 (L2 0.037)Green: C1/G2 degree 6 (L2 0.022)Magenta: G2 degree 6 (L2 0.018)

Page 29: Linear Methods for Degree Reduction of Bézier Curves with ...

Spiral Example

Degree 19 reduced to degree 8

Black: Degree 19 curveRed: C2 degree 8 (L2 0.037)Blue: C1/G2 degree 8 (L2 0.022)

Page 30: Linear Methods for Degree Reduction of Bézier Curves with ...

Loop Example

Degree 13 reduced to degree 8

400

450

500

550

600

650

200 300 400 500 600 700

Blue: degree 13Red: C2 degree 8, L2=486

Green: C1/G2 degree 8, L2=58

Page 31: Linear Methods for Degree Reduction of Bézier Curves with ...

Heart Example

Degree 13 reduced to degree 8

350

400

450

500

550

600

300 400 500 600 700

Blue: degree 13Red: C2 degree 8, L2=15.3

Green: C1/G2 degree 8, L2=6.5

Page 32: Linear Methods for Degree Reduction of Bézier Curves with ...

Degree 55, C1/G3

Degree 55 reduced to degree 15

200

300

400

500

600

700

0 200 400 600 800 1000 1200 1400

Blue: degree 55Red: C3 degree 15, L2=35

Green: C1/G3 degree 15, L2=9.2

Page 33: Linear Methods for Degree Reduction of Bézier Curves with ...

Numerics

• Mmm positive definite, but condition number large

For m = 15 condition number is 108

For m = 30 condition number is 1016

• Octave techniques to solve linear system

– inverse — invert the matrix

– backslash — solve linear system without inverting

Occasionally caused Octave to crash

– LUP (Gaussian elimination with pivoting)[l,u,p]=lu(a); u\l\(p*b)

Worked for degr. 55 reduced to degr. 54 (L∞ of 10−6,10−9)

(32 orders of magnitude in Mmm entries)

Page 34: Linear Methods for Degree Reduction of Bézier Curves with ...

Numerics

• Mmm positive definite, but condition number large

For m = 15 condition number is 108

For m = 30 condition number is 1016

• Octave techniques to solve linear system

– inverse — invert the matrix inverse(a)*b

– backslash — solve linear system without inverting a\bOccasionally caused Octave to crash

– LUP (Gaussian elimination with pivoting)[l,u,p]=lu(a); u\l\(p*b)

Worked for degr. 55 reduced to degr. 54 (L∞ of 10−6,10−9)

(32 orders of magnitude in Mmm entries)

Page 35: Linear Methods for Degree Reduction of Bézier Curves with ...

Numerics

• Mmm positive definite, but condition number large

For m = 15 condition number is 108

For m = 30 condition number is 1016

• Octave techniques to solve linear system

– inverse — invert the matrix inverse(a)*b

– backslash — solve linear system without inverting a\bOccasionally caused Octave to crash

– LUP (Gaussian elimination with pivoting)[l,u,p]=lu(a); u\l\(p*b)

Worked for degr. 55 reduced to degr. 54 (L∞ of 10−6,10−9)

(32 orders of magnitude in Mmm entries)

Page 36: Linear Methods for Degree Reduction of Bézier Curves with ...

Numerics

• Mmm positive definite, but condition number large

For m = 15 condition number is 108

For m = 30 condition number is 1016

• Octave techniques to solve linear system

– inverse — invert the matrix inverse(a)*b

– backslash — solve linear system without inverting a\bOccasionally caused Octave to crash

– LUP (Gaussian elimination with pivoting)[l,u,p]=lu(a); u\l\(p*b)

Worked for degr. 55 reduced to degr. 54 (L∞ of 10−6,10−9)

(32 orders of magnitude in Mmm entries)

Page 37: Linear Methods for Degree Reduction of Bézier Curves with ...

Octave: inverse vs LUP

Degree 55 curve, reduce to degree m, G1 at ends

m

inverse

LUP

log1

0(L2

)

-6

-5

-4

-3

-2

-1

0

1

2

15 20 25 30 35 40 45 50

• Numerics mostly a non-issue since we want to reduce to lowdegrees.

Page 38: Linear Methods for Degree Reduction of Bézier Curves with ...

Summary

• Degree reduce Bezier curves

– G1, C1/G2, C1/G3 continuity

– Linear methods

– Good numerics

Page 39: Linear Methods for Degree Reduction of Bézier Curves with ...

Question?


Recommended