interpolation and polynomial approximation interpolationinterpolation instead of setting the...

88
1 CAD & Computational Geometry Outline Interpolation and polynomial approximation Interpolation Lagrange Cubic Splines Approximation Bézier curves B-Splines

Upload: others

Post on 14-Oct-2020

11 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Interpolation and polynomial approximation InterpolationInterpolation Instead of setting the polynomial in x and in y and solving, we can put it under the following form :, where the

1

CAD & Computational Geometry

Outline

Interpolation and polynomial approximation Interpolation

Lagrange Cubic Splines

Approximation Bézier curves B-Splines

Page 2: Interpolation and polynomial approximation InterpolationInterpolation Instead of setting the polynomial in x and in y and solving, we can put it under the following form :, where the

2

CAD & Computational Geometry

Some vocabulary (again ;) Control point : Geometric point that serves as

support to the curve Knot : a specific value of the parameter u

corresponding to a joint between pieces of a curve Knot sequence : the set of knots values (in an

increasing order).

Wolfram

research

Page 3: Interpolation and polynomial approximation InterpolationInterpolation Instead of setting the polynomial in x and in y and solving, we can put it under the following form :, where the

3

CAD & Computational Geometry

Interpolation The curve passes through the control points

Approximation The curve doesn't necessary passes through the

control points But these have an influence ...

Statistic approaches ? Least squares « Kriging » Not very adapted to geometric modelling

Page 4: Interpolation and polynomial approximation InterpolationInterpolation Instead of setting the polynomial in x and in y and solving, we can put it under the following form :, where the

4

CAD & Computational Geometry

Interpolation

Page 5: Interpolation and polynomial approximation InterpolationInterpolation Instead of setting the polynomial in x and in y and solving, we can put it under the following form :, where the

5

CAD & Computational Geometry

Interpolation

Interpolation We want draw a regular and smooth parametric

curve through a certain number n of points Pi

Several families of base functions are available Most obvious are polynomials There are others -

Trigonometric functions (by mean of a Fourier decomposition for instance)

Power functions etc...

Page 6: Interpolation and polynomial approximation InterpolationInterpolation Instead of setting the polynomial in x and in y and solving, we can put it under the following form :, where the

6

CAD & Computational Geometry

Interpolation

We must choose the parametrization (nodal sequence)

Uniform

u0=0

u1=1

u2=2

un-1

=n-1

Page 7: Interpolation and polynomial approximation InterpolationInterpolation Instead of setting the polynomial in x and in y and solving, we can put it under the following form :, where the

7

CAD & Computational Geometry

Interpolation

Or non-uniform

u0=0

u1=2.5

u2=7

un-1

=15

Page 8: Interpolation and polynomial approximation InterpolationInterpolation Instead of setting the polynomial in x and in y and solving, we can put it under the following form :, where the

8

CAD & Computational Geometry

Interpolation

Can we choose u as a curvilinear abscissa ? In principle no since we don't know the final shape

of the curve beforehand (with the exception of interpolation points)

We will see later that it is often impossible that u corresponds with s exactly along the whole curve using analytical functions.

But nothing forbids to get close to that – numerically...

Page 9: Interpolation and polynomial approximation InterpolationInterpolation Instead of setting the polynomial in x and in y and solving, we can put it under the following form :, where the

9

CAD & Computational Geometry

Interpolation

Parametrization as an approximate arc length

u0=0

u1=d

1

u2=d

1+d

2

d1

dn-1

d2

un-1

=d1+...+d

n-1

Page 10: Interpolation and polynomial approximation InterpolationInterpolation Instead of setting the polynomial in x and in y and solving, we can put it under the following form :, where the

10

CAD & Computational Geometry

Interpolation

In all cases, we want to have :

We are going to interpolate the functions x(u) and y(u) with ONE polynomial with n parameters

This one must be of order p=n-1 :

We set the linear system and solve...

P ui=P i ≡ {xui=xi

y ui= y i

x u=a0a1 ua2 u2⋯an−1 un−1

=∑j=0

n−1

a j uj

{x u1=x1

x un−1=xn−1

Page 11: Interpolation and polynomial approximation InterpolationInterpolation Instead of setting the polynomial in x and in y and solving, we can put it under the following form :, where the

11

CAD & Computational Geometry

Interpolation

Vandermonde matrix

Can be solved by classical numerical methods, but ... The condition number of this matrix is VERY bad

It must be solved for each RHS member ( ( xi ) or ( y

i ) )

, or have to take the inverse of this matrix, or perform an LU decomposition.

{x u1=x1

x un−1=xn−1 (1 u0 u0

2⋯ u0

n−1

1 u1 u12

⋯ u1n−1

⋮ ⋮ ⋮ ⋮ ⋮

1 un−1 un−12

⋯ un−1n−1)(

a0

a1

⋮an−1

)=(x0

x1

⋮xn−1

)

Page 12: Interpolation and polynomial approximation InterpolationInterpolation Instead of setting the polynomial in x and in y and solving, we can put it under the following form :, where the

12

CAD & Computational Geometry

Interpolation

Instead of setting the polynomial in x and in y and solving, we can put it under the following form :

, where the lip(u) are a polynomial basis of order p=n-1.

These polynomials verify, for an interpolation :

We have only one computation to do for any position of the interpolation points, knowing the u

i

(the parametrization)

{x u=∑

0

n−1

x i l ipu

y u=∑0

n−1

yi l ipu

⇔ P u=∑0

n−1

Pi l ipu

l ipu j= ij

Page 13: Interpolation and polynomial approximation InterpolationInterpolation Instead of setting the polynomial in x and in y and solving, we can put it under the following form :, where the

13

CAD & Computational Geometry

Lagrange polynomials

Order 4 The u

i are evenly

distributed between u=0 and u=1

The sum is equal to 1 (partition of unity)

Presence of negative values

Page 14: Interpolation and polynomial approximation InterpolationInterpolation Instead of setting the polynomial in x and in y and solving, we can put it under the following form :, where the

14

CAD & Computational Geometry

Lagrange polynomials

Order 10 Presence of huge

overshoots near the boundaries

Page 15: Interpolation and polynomial approximation InterpolationInterpolation Instead of setting the polynomial in x and in y and solving, we can put it under the following form :, where the

15

CAD & Computational Geometry

Lagrange polynomials

The interpolation is represented by the following form :

Two things worth noting: The curve depends linearly on the position of the

points It is formed by a weighted sum of basis functions

that express the influence of each point on the curve

P (u)=∑i=0

n−1

P i l ip(u) with l i

p(u)= ∏

j=0, i≠ j

n−1 (u−ui)

(u j−ui)

Page 16: Interpolation and polynomial approximation InterpolationInterpolation Instead of setting the polynomial in x and in y and solving, we can put it under the following form :, where the

16

CAD & Computational Geometry

Lagrange polynomials

An experiment We approximate a circle by an increasing number

of points Simultaneously , approximation order increases

In every case, the curve is C

Page 17: Interpolation and polynomial approximation InterpolationInterpolation Instead of setting the polynomial in x and in y and solving, we can put it under the following form :, where the

17

CAD & Computational Geometry

3 points, order 2 (a parabola !)

Lagrange polynomials

Page 18: Interpolation and polynomial approximation InterpolationInterpolation Instead of setting the polynomial in x and in y and solving, we can put it under the following form :, where the

18

CAD & Computational Geometry

5 points, order 4

Lagrange polynomials

Page 19: Interpolation and polynomial approximation InterpolationInterpolation Instead of setting the polynomial in x and in y and solving, we can put it under the following form :, where the

19

CAD & Computational Geometry

11 points, order 10

Lagrange polynomials

Page 20: Interpolation and polynomial approximation InterpolationInterpolation Instead of setting the polynomial in x and in y and solving, we can put it under the following form :, where the

20

CAD & Computational Geometry

21 points, order 20

Lagrange polynomials

Page 21: Interpolation and polynomial approximation InterpolationInterpolation Instead of setting the polynomial in x and in y and solving, we can put it under the following form :, where the

21

CAD & Computational Geometry

Lagrange polynomials

Does it work ? The points were set exactly on the circle

What occurs if their position is inaccurate ? Or if the approximated shape is not so simple ? We are going to see two cases

The coordinates of the points are perturbed randomly A deterministic increase and decrease of the radius

Page 22: Interpolation and polynomial approximation InterpolationInterpolation Instead of setting the polynomial in x and in y and solving, we can put it under the following form :, where the

22

CAD & Computational Geometry

Lagrange perturbation

Random perturbation Each point is moved radially by a value between -

0.5 and +0.5 % of the circle's radius

Page 23: Interpolation and polynomial approximation InterpolationInterpolation Instead of setting the polynomial in x and in y and solving, we can put it under the following form :, where the

23

CAD & Computational Geometry

3 points, random perturbation 1%

Lagrange polynomials

Page 24: Interpolation and polynomial approximation InterpolationInterpolation Instead of setting the polynomial in x and in y and solving, we can put it under the following form :, where the

24

CAD & Computational Geometry

5 points, random perturbation 1%

Lagrange polynomials

Page 25: Interpolation and polynomial approximation InterpolationInterpolation Instead of setting the polynomial in x and in y and solving, we can put it under the following form :, where the

25

CAD & Computational Geometry

11 points, random perturbation 1%

Lagrange polynomials

Page 26: Interpolation and polynomial approximation InterpolationInterpolation Instead of setting the polynomial in x and in y and solving, we can put it under the following form :, where the

26

CAD & Computational Geometry

21 points, random perturbation 1%

Lagrange polynomials

Page 27: Interpolation and polynomial approximation InterpolationInterpolation Instead of setting the polynomial in x and in y and solving, we can put it under the following form :, where the

27

CAD & Computational Geometry

Lagrange polynomials

Runge phenomenon Similar to Gibbs phenomenon of the

decompositions in harmonic functions

Page 28: Interpolation and polynomial approximation InterpolationInterpolation Instead of setting the polynomial in x and in y and solving, we can put it under the following form :, where the

28

CAD & Computational Geometry

Lagrange polynomials

How to minimize Runge's phenomenon ? The problem here is the use of a unique polynomial

and regular intervals between knots. Instead, if we concentrate knots at the extremities,

the interpolation is less prone to Runge's phenomenon.

Make use of Chebyshev knots:

in the interval [-1,1]

or in the interval [0,1]

uin=cos ( 2 i−1

2 nπ)

uin=

12+

12

cos( 2 i−12 n

π)

Page 29: Interpolation and polynomial approximation InterpolationInterpolation Instead of setting the polynomial in x and in y and solving, we can put it under the following form :, where the

29

CAD & Computational Geometry

21 points, random perturbation 1%

Uniform nodal intervals – lagrange interpolation

Lagrange polynomials

Page 30: Interpolation and polynomial approximation InterpolationInterpolation Instead of setting the polynomial in x and in y and solving, we can put it under the following form :, where the

30

CAD & Computational Geometry

21 points, random perturbation 1%

Using Chebychev knots

Lagrange polynomials

Page 31: Interpolation and polynomial approximation InterpolationInterpolation Instead of setting the polynomial in x and in y and solving, we can put it under the following form :, where the

31

CAD & Computational Geometry

Lagrange polynomials

Morality : Lagrange interpolation is not suited beyond 10's of

control points because of the Runge phenomenon A modification of the position of a control point

leads to global changes of the curve. (The evaluation of high order polynomials

expressed as monomials leads to numerical problems.)

No control of the slopes at the boundary of the curve (start and finish).

Page 32: Interpolation and polynomial approximation InterpolationInterpolation Instead of setting the polynomial in x and in y and solving, we can put it under the following form :, where the

32

CAD & Computational Geometry

Splines

Page 33: Interpolation and polynomial approximation InterpolationInterpolation Instead of setting the polynomial in x and in y and solving, we can put it under the following form :, where the

33

CAD & Computational Geometry

Splines

MotivationLet us imagine that we have many (100's of) control points

But we don't want a Lagrange interpolation ! We should stay with a low order scheme but

conserve enough freedom to pass through every point

Curve defined by pieces ... and of low order (1)

Page 34: Interpolation and polynomial approximation InterpolationInterpolation Instead of setting the polynomial in x and in y and solving, we can put it under the following form :, where the

34

CAD & Computational Geometry

Splines

We are going to build a low order interpolation for each knot interval, such that we can impose slopes at the knots.

u=ui+1

u=ui

P=Pi+1

P=Pi

P'=P'i

P'=P'i+1

Page 35: Interpolation and polynomial approximation InterpolationInterpolation Instead of setting the polynomial in x and in y and solving, we can put it under the following form :, where the

35

CAD & Computational Geometry

Splines

In each range [i,i+1] , we want to have an independent polynomial

We have 4 parameters : position at each knot and associated tangents.

The basis must have 4 degrees of freedom, thus be of order 3 in the case of polynomials.

x [i ]u=A[i ]0A[i ]1 uA[ i ]2 u2A[i ]3 u3 , u∈[ui , ui1]

P (ui)=P i ≡ {x (ui)=x i

y (ui)= y i

...

Page 36: Interpolation and polynomial approximation InterpolationInterpolation Instead of setting the polynomial in x and in y and solving, we can put it under the following form :, where the

36

CAD & Computational Geometry

Splines

First, every interval has a unit length i.e.

Then we ensure identical intervals [0...1] between each interpolation point :

On each interval i , we thus have the following relation:

ui1−ui=1

u=u−ui

u i1−ui

=u−ui

x[ i ](u)=a[ i ]0+a[ i]1 u+a[ i ]2 u2+a[i ]3 u3 , u∈[0,1]

d udu

=1

Page 37: Interpolation and polynomial approximation InterpolationInterpolation Instead of setting the polynomial in x and in y and solving, we can put it under the following form :, where the

37

CAD & Computational Geometry

Splines

P=Pi+1

P=Pi

P'=P'i

P'=P'i+1

u=0

u=1

Page 38: Interpolation and polynomial approximation InterpolationInterpolation Instead of setting the polynomial in x and in y and solving, we can put it under the following form :, where the

38

CAD & Computational Geometry

Splines

We pass through both control points:

We impose both slopes :

At the end :

P (u=0)=P i⇔a[ i ]0+a[ i ]1 u+a[ i ]2 u2+a[i ]3 u3

=x i

P (u=1)=P i+1⇔a[ i ]0+a[ i ]1 u+a[i ]2 u2+a[i ]3 u3

=x i+1

P '(u0=0)=P 'i⇔a[ i ]1+2a[ i ]2 u+3 a[i ]3 u2

=xi'

P '(u=1)=P 'i+1⇔a[ i ]1+2 a[ i]2 u+3 a[ i ]3 u2

=xi+1'

{a[i ]0=xi

a[i ]1=x i'

a[i ]2=3 xi1−x i−2 xi'−x i1

'

a[i ]3=2xi−x i1xi'x i1

'

Page 39: Interpolation and polynomial approximation InterpolationInterpolation Instead of setting the polynomial in x and in y and solving, we can put it under the following form :, where the

39

CAD & Computational Geometry

Splines

We have continuity We have continuity of the derivatives But how to choose the slopes ?

Let the user choose ( “artistic” freedom) Automatically ...

Page 40: Interpolation and polynomial approximation InterpolationInterpolation Instead of setting the polynomial in x and in y and solving, we can put it under the following form :, where the

40

CAD & Computational Geometry

Splines

By finite differences with three points :

At the boundaries, we use finite differences (asymmetric)

The result depends on the parametrization ! Cardinal spline

c is a « tension » parameter. c=0 gives yields the so called “Catmull-Rom” spline, c=1 a zigzagging line.

x i'=

xi1−xi

2 ui1−ui

xi−xi−1

2 ui−ui−1

x0'=

x1−x0

u1−u0

xn−1'

=xn−1−xn−2

un−1−un−2

x i'=1−c

x i1−xi−1

2 , 0≤c≤1

x0'=(1−c)(x1− x0)

xn−1'

=(1−c)(xn−1−xn−2)

Page 41: Interpolation and polynomial approximation InterpolationInterpolation Instead of setting the polynomial in x and in y and solving, we can put it under the following form :, where the

41

CAD & Computational Geometry

Splines

5 points, finite differences by varying the parametrization [0..1] , [0..2] , [0..5] , [0..10]

Continuity of the curve/parameter but loss of regularity (and of geometric continuityin many cases)

Page 42: Interpolation and polynomial approximation InterpolationInterpolation Instead of setting the polynomial in x and in y and solving, we can put it under the following form :, where the

42

CAD & Computational Geometry

Splines

5 points, Cardinal Spline (Catmull-Rom) c=0

Page 43: Interpolation and polynomial approximation InterpolationInterpolation Instead of setting the polynomial in x and in y and solving, we can put it under the following form :, where the

43

CAD & Computational Geometry

Splines

Catmull-Rom Splines are widely used in computer graphics Simple to compute, effective Local control (price to pay : discontinuous secd derivative) Animations with keyframing

Ensures a fluid motion because of the continuity of the slope

Page 44: Interpolation and polynomial approximation InterpolationInterpolation Instead of setting the polynomial in x and in y and solving, we can put it under the following form :, where the

44

CAD & Computational Geometry

Splines

5 points, Cardinal Spline c=0.25

Page 45: Interpolation and polynomial approximation InterpolationInterpolation Instead of setting the polynomial in x and in y and solving, we can put it under the following form :, where the

45

CAD & Computational Geometry

Splines

5 points, Cardinal Spline c=0.5

Page 46: Interpolation and polynomial approximation InterpolationInterpolation Instead of setting the polynomial in x and in y and solving, we can put it under the following form :, where the

46

CAD & Computational Geometry

Splines

5 points, Cardinal Spline c=0.75

Page 47: Interpolation and polynomial approximation InterpolationInterpolation Instead of setting the polynomial in x and in y and solving, we can put it under the following form :, where the

47

CAD & Computational Geometry

Splines

5 points, Cardinal Spline c=1.0

Page 48: Interpolation and polynomial approximation InterpolationInterpolation Instead of setting the polynomial in x and in y and solving, we can put it under the following form :, where the

48

CAD & Computational Geometry

Splines

We can impose the continuity of second derivatives... On a curve with n points, we have n extra relations to

impose We may impose the continuity of the second derivative only

on the n-2 interior knots

What about the 2 points on the boundary ? Impose a vanishing second derivative.

We obtain what is called « natural spline » We could also impose the slopes (i.e. only n-2 relations remaining) Or , impose that the third derivative is zero on the points 1 and n-2

That means a single polynomial expression for the first two knot intervals, and the last two.

Page 49: Interpolation and polynomial approximation InterpolationInterpolation Instead of setting the polynomial in x and in y and solving, we can put it under the following form :, where the

49

CAD & Computational Geometry

Splines

Natural Spline : mathematical approximation of the spline historically used in naval construction.

C. D

eBoor

Page 50: Interpolation and polynomial approximation InterpolationInterpolation Instead of setting the polynomial in x and in y and solving, we can put it under the following form :, where the

50

CAD & Computational Geometry

Splines

Boeing

Page 51: Interpolation and polynomial approximation InterpolationInterpolation Instead of setting the polynomial in x and in y and solving, we can put it under the following form :, where the

51

CAD & Computational Geometry

Splines

We impose the continuity of the second derivatives

We substitute in the “internal” equations

Finally we obtain :

x[ i−1]

''1=x [i ]

''0⇔2a[ i−1]26a[ i−1]3=2a[i ]2

2 [3 x i−x i−1−2 x i−1'

−x i']6 [2 x i−1−x ix i−1

'x i

']

=2 [3 x i1−x i−2 x i'−x i1

']

x i−1'

4 x i'x i1

'=3xi1−x i−1

Page 52: Interpolation and polynomial approximation InterpolationInterpolation Instead of setting the polynomial in x and in y and solving, we can put it under the following form :, where the

52

CAD & Computational Geometry

Splines

At the boundaries we want

We have then a linear system with n unknowns :

x [0]

''0=0⇔2a[0]2=0

x [n−2]

''1=0⇔2a[n−2]26a[n−2]3=0

2 x0'x1

'=3x1−x0

xn−2'

2 xn−1'

=3xn−1−xn−2

2 11 4 1

1 4 1⋱

1 4 11 2

x0

'

x1'

x2'

xn−2'

xn−1'

=3x1−x0

3 x2−x0

3x3−x1

3xn−1−xn−3

3 xn−1−xn−2

Page 53: Interpolation and polynomial approximation InterpolationInterpolation Instead of setting the polynomial in x and in y and solving, we can put it under the following form :, where the

53

CAD & Computational Geometry

Splines

By solving the system, we have :

, which is substituted in

,to get the polynomial in each portion :

From the global parameter u, we have to find in which portion we are ( the value of i ) , then compute right polynomial...

x0

'

x1'

x2'

xn−2'

xn−1'

{a[ i ]0=xi

a[ i ]1=x i'

a[ i ]2=3 xi1−x i−2 xi'−x i1

'

a[ i ]3=2xi−x i1xi'x i1

'

x [i ]u =a[i ]0a[ i ]1ua[ i ]2 u2a[ i ]3 u

3 , 0≤u1

Page 54: Interpolation and polynomial approximation InterpolationInterpolation Instead of setting the polynomial in x and in y and solving, we can put it under the following form :, where the

54

CAD & Computational Geometry

Splines

5 control points, natural spline

Catmull-Rom spline

Page 55: Interpolation and polynomial approximation InterpolationInterpolation Instead of setting the polynomial in x and in y and solving, we can put it under the following form :, where the

55

CAD & Computational Geometry

Splines

Another experiment We approximate a circle by a number of increasing

points Simultaneously , the order of the approximation the

number of pieces increases.

In all the cases, the curve is C C

2

Page 56: Interpolation and polynomial approximation InterpolationInterpolation Instead of setting the polynomial in x and in y and solving, we can put it under the following form :, where the

56

CAD & Computational Geometry

Splines

3 points, order 3!

Page 57: Interpolation and polynomial approximation InterpolationInterpolation Instead of setting the polynomial in x and in y and solving, we can put it under the following form :, where the

57

CAD & Computational Geometry

Splines

5 points

Page 58: Interpolation and polynomial approximation InterpolationInterpolation Instead of setting the polynomial in x and in y and solving, we can put it under the following form :, where the

58

CAD & Computational Geometry

Splines

11 points

Page 59: Interpolation and polynomial approximation InterpolationInterpolation Instead of setting the polynomial in x and in y and solving, we can put it under the following form :, where the

59

CAD & Computational Geometry

Splines

21 points

Page 60: Interpolation and polynomial approximation InterpolationInterpolation Instead of setting the polynomial in x and in y and solving, we can put it under the following form :, where the

60

CAD & Computational Geometry

Splines

Random perturbation Each point is moved radially by a value between -

0.5 and +0.5 % of the circle's radius

Page 61: Interpolation and polynomial approximation InterpolationInterpolation Instead of setting the polynomial in x and in y and solving, we can put it under the following form :, where the

61

CAD & Computational Geometry

Splines

3 points, random perturbation 1%

Page 62: Interpolation and polynomial approximation InterpolationInterpolation Instead of setting the polynomial in x and in y and solving, we can put it under the following form :, where the

62

CAD & Computational Geometry

Splines

5 points, random perturbation 1%

Page 63: Interpolation and polynomial approximation InterpolationInterpolation Instead of setting the polynomial in x and in y and solving, we can put it under the following form :, where the

63

CAD & Computational Geometry

Splines

11 points, random perturbation 1%

Page 64: Interpolation and polynomial approximation InterpolationInterpolation Instead of setting the polynomial in x and in y and solving, we can put it under the following form :, where the

64

CAD & Computational Geometry

Splines

21 points, random perturbation 1%

Page 65: Interpolation and polynomial approximation InterpolationInterpolation Instead of setting the polynomial in x and in y and solving, we can put it under the following form :, where the

65

CAD & Computational Geometry

Splines

Deterministic perturbation Each point is shifted radially depending on its

position by -5 or +5 % of the circle's radius

Page 66: Interpolation and polynomial approximation InterpolationInterpolation Instead of setting the polynomial in x and in y and solving, we can put it under the following form :, where the

66

CAD & Computational Geometry

Splines

3 points, deterministic perturbation 5%

Page 67: Interpolation and polynomial approximation InterpolationInterpolation Instead of setting the polynomial in x and in y and solving, we can put it under the following form :, where the

67

CAD & Computational Geometry

Splines

5 points, deterministic perturbation 5%

Page 68: Interpolation and polynomial approximation InterpolationInterpolation Instead of setting the polynomial in x and in y and solving, we can put it under the following form :, where the

68

CAD & Computational Geometry

Splines

11 points, deterministic perturbation 5%

Page 69: Interpolation and polynomial approximation InterpolationInterpolation Instead of setting the polynomial in x and in y and solving, we can put it under the following form :, where the

69

CAD & Computational Geometry

Splines

21 points, deterministic perturbation 5%

Page 70: Interpolation and polynomial approximation InterpolationInterpolation Instead of setting the polynomial in x and in y and solving, we can put it under the following form :, where the

70

CAD & Computational Geometry

Splines

11 points

non local control

Page 71: Interpolation and polynomial approximation InterpolationInterpolation Instead of setting the polynomial in x and in y and solving, we can put it under the following form :, where the

71

CAD & Computational Geometry

Splines

Page 72: Interpolation and polynomial approximation InterpolationInterpolation Instead of setting the polynomial in x and in y and solving, we can put it under the following form :, where the

72

CAD & Computational Geometry

Splines

Perturbation of a point We shift one point by a significant amount

Page 73: Interpolation and polynomial approximation InterpolationInterpolation Instead of setting the polynomial in x and in y and solving, we can put it under the following form :, where the

73

CAD & Computational Geometry

Splines

21 points

Page 74: Interpolation and polynomial approximation InterpolationInterpolation Instead of setting the polynomial in x and in y and solving, we can put it under the following form :, where the

74

CAD & Computational Geometry

99 points

Splines

Page 75: Interpolation and polynomial approximation InterpolationInterpolation Instead of setting the polynomial in x and in y and solving, we can put it under the following form :, where the

75

CAD & Computational Geometry

Splines

999 points

Page 76: Interpolation and polynomial approximation InterpolationInterpolation Instead of setting the polynomial in x and in y and solving, we can put it under the following form :, where the

76

CAD & Computational Geometry

Splines

Stable interpolation scheme Weak Runge phenomenon The displacement of a point yet affects all the

curve Nevertheless, the perturbation fades very quickly

further away from the shifted point « Overshoots » are limited.

Page 77: Interpolation and polynomial approximation InterpolationInterpolation Instead of setting the polynomial in x and in y and solving, we can put it under the following form :, where the

77

CAD & Computational Geometry

Splines

Closed curve ? The curve can be closed, just impose everywhere

that the second derivative is continuous.

Page 78: Interpolation and polynomial approximation InterpolationInterpolation Instead of setting the polynomial in x and in y and solving, we can put it under the following form :, where the

78

CAD & Computational Geometry

Splines

Instead of

... we have

(4 1 11 4 1

1 4 1⋱

1 4 11 1 4

)(x0

'

x1'

x2'

xn−3'

x n−2'

)=(3(x1−xn−2)

3(x2−x0)

3(x3−x1)

⋮3( xn−2− xn−4)

3(x0−x n−3))

x[n−2]

''(1)=x[0 ]

''(0)⇔2a[n−2 ]2+6a[n−2 ]3=2a [0]2

x [0]

''0=0⇔2a[0]2=0

x [n−2]

''1=0⇔2a[n−2]26a[n−2]3=0

Circulantmatrix

xn−1=x0

xn−1'

=x0'and

Page 79: Interpolation and polynomial approximation InterpolationInterpolation Instead of setting the polynomial in x and in y and solving, we can put it under the following form :, where the

79

CAD & Computational Geometry

Splines

General case : arbitrary parametrization

We again change the parametrization...

P (ui)=P i ≡ {x (ui)= xi

y (ui)= y i

x[ i ](u)=A[ i ]0+ A[ i ]1 u+A[ i ]2 u2+ A[ i ]3 u3 , u∈[ui , ui+1]

u=u−ui

ui+1−ui

x[i ](u)=a[ i ]0+a[ i ]1 u+a[ i ]2 u2+a[ i ]3 u3 , u∈[0,1]

d udu

=1

ui+1−ui

=1hi

Page 80: Interpolation and polynomial approximation InterpolationInterpolation Instead of setting the polynomial in x and in y and solving, we can put it under the following form :, where the

80

CAD & Computational Geometry

Splines

We pass through both points :

We impose both slopes :

Finally :

P u0=0=P i⇔a[i ]0a[i ]1 u0a[i ]2u02a[i ]3 u0

3=xi

P u1=1=Pi1⇔a[i ]0a[i ]1 u1a[i ]2 u12a[i ]3 u1

3=x i1

P 'u0=0=

d Pd u

0=d Pd u

01hi

=P 'i⇔a[i ]12a [ i ]2 u03a [i]3u02=x i

' hi

P 'u1=1=

d Pd u

1=d Pd u

11hi

=P 'i1⇔a[i ]12a[ i ]2 u13a[ i ]3 u12=x i1

' hi

{a[i ]0=x i

a[i ]1=x i' hi

a[i ]2=3 x i1− xi−2 x i' hi−x i1

' hi

a[i ]3=2 x i−x i1x i' hix i1

' hi

Page 81: Interpolation and polynomial approximation InterpolationInterpolation Instead of setting the polynomial in x and in y and solving, we can put it under the following form :, where the

81

CAD & Computational Geometry

Splines

We impose the second derivative for a natural spline

We substitute in the internal equations

d 2 P [i ]

du2 u=d 2 P[i ]

d u2

d 2u

d u2 =d 2 P [ i]

d u2

1

hi2

2 [3 xi−x i−1−2 x i−1' hi−1−x i

' hi−1]6 [2 x i−1−x ix i−1' hi−1x i

' hi−1]

hi−12

=2 [3 x i1−x i−2 x i

' hi−x i1' hi ]

hi2

x[ i−1]''

1=x[i ]''0⇔

2a[ i−1]26a [ i−1]3

hi−12

=2a [i]2

hi2

Page 82: Interpolation and polynomial approximation InterpolationInterpolation Instead of setting the polynomial in x and in y and solving, we can put it under the following form :, where the

82

CAD & Computational Geometry

Splines

We obtain finally :

x i−1'

2 x i'

hi−1

2 x i

'x i1

'

hi

=3 x i−x i−1

hi−12

3 x i1−x i

hi2

hi x i−1'

2 x i'hi−12 xi

' xi1

'=3

hi

hi−1

x i−x i−13hi−1

hi

x i1−x i

Page 83: Interpolation and polynomial approximation InterpolationInterpolation Instead of setting the polynomial in x and in y and solving, we can put it under the following form :, where the

83

CAD & Computational Geometry

Splines

At the boundaries we want a vanishing second derivative …

We have then a linear system of n unknowns:

(next page)

x[0]

''(0)=0⇔

2a [0]2

(h02)=0

x[n−2]

''(1)=0⇔

2a[n−2 ]2+6a[n−2 ]3

(hn−22

)=0

h0(2 x0'+ x1

')=3(x1−x0)

hn−2(xn−2'

+2 xn−1'

)=3(xn−1−xn−2)

Page 84: Interpolation and polynomial approximation InterpolationInterpolation Instead of setting the polynomial in x and in y and solving, we can put it under the following form :, where the

84

CAD & Computational Geometry

Splines

(2h0 h0

h1 2 h1+2h0 h0

hn−2 2 hn−2+2 hn−3 hn−3

hn−2 2hn−2

)(x0

'

x1'

xn−2'

xn−1'

)=

(3(x1−x0)

3h1

h0

(x1− x0)+3h0

h1

(x 2−x1)

3hn−2

hn−3

(xn−2−xn−3)+3hn−3

hn−2

(xn−1−xn−2)

3(xn−1−xn−2)

)

Page 85: Interpolation and polynomial approximation InterpolationInterpolation Instead of setting the polynomial in x and in y and solving, we can put it under the following form :, where the

85

CAD & Computational Geometry

Splines

Natural Spline(uniform parametrization)

Natural Spline(non uniform parametrization)

u=0

u=1

u=2

u=4

u=5

u=3

u=4

Page 86: Interpolation and polynomial approximation InterpolationInterpolation Instead of setting the polynomial in x and in y and solving, we can put it under the following form :, where the

86

CAD & Computational Geometry

Splines

Compact notation We would like a compact representation as for the

Lagrange interpolation.

This on each interval [i,i+1].

x[i ](u)=a[ i ]0+a[ i ]1 u+a[i ]2 u2+a[i ]3 u3

0≤u<1

{x[ i](u)=∑

0

n

xi hi 0p(u)+∑

0

n

x i' hi 1

p(u)

y[ i ](u)=∑0

n

yi hi 0p(u)+∑

0

n

y i' hi 1

p(u)

...

⇔ P[i ](u)=∑0

n

P i hi 0p(u)+∑

0

n

Pi' hi 1

p(u)

{a[i ]0=xi

a[i ]1=x i'

a[i ]2=3 xi1−x i−2 xi'−x i1

'

a[i ]3=2xi−x i1xi'x i1

'

Page 87: Interpolation and polynomial approximation InterpolationInterpolation Instead of setting the polynomial in x and in y and solving, we can put it under the following form :, where the

87

CAD & Computational Geometry

Splines

We have on each interval :

By rearranging equations

{a[i ]0=xi

a[i ]1=x i'

a[i ]2=3 xi1−x i−2 xi'−x i1

'

a[i ]3=2xi−x i1xi'x i1

'

x [i ]u =xix i'u3x i1−x i−2 x i

'−xi1

' u

22 xi−x i1xi

'x i1

'u

3

x [i ]u=xi 1−3u22u

3x i

'u−2u

2u

3

x i13u2−2 u

3xi1

'−u

2u

3

Page 88: Interpolation and polynomial approximation InterpolationInterpolation Instead of setting the polynomial in x and in y and solving, we can put it under the following form :, where the

88

CAD & Computational Geometry

Splines

3D Curves Minimal order so that a curve can have a torsion

(non planar curve) Let's consider a Lagrange interpolation 2 points → on a straight line (no curvature) 3 points → in a plane (no torsion) 4 points → torsion becomes possible

Minimal order to join smoothly two arbitrarily oriented curves = 3

P u=∑i=0

n−1

P i l ipu