june 20101 3d object representation shmuel wimer bar ilan univ., school of engineering

18
June 2010 1 3D Object Representation Shmuel Wimer Bar Ilan Univ., School of Engineering

Upload: emil-douglas

Post on 03-Jan-2016

214 views

Category:

Documents


1 download

TRANSCRIPT

June 2010 1

3D Object Representation

Shmuel Wimer

Bar Ilan Univ., School of Engineering

June 2010 2

Spline RepresentationSpline is a flexible strip used to produce a smooth curve through a set of

points. Splines are used to design curve and surface shapes like automobile

bodies, aircrafts, home appliances and more.

Cubic splines are most popular. given a set of 1 control points

, , , 0,1, , , a cubic interpolation fits the points. k k k k

n

x y z k n

p

0pnp

kp 1kp

3 2 3 2

3 2

,

, 0 1.

x x x x y y y y

z z z z

x u a u b u c u d y u a u b u c u d

z u a u b u c u d u

June 2010 3

At each of n-1 internal point we require that two successive curve sections

pass through that point and also the equality of their 1st and 2nd derivatives,

thus imposing 4(n-1) equations of 4n polynomial coefficients. Two more

equations are obtained from passing through the first and last points. The

last two equations can be obtained by requiring the 2nd derivative at first

and last points to be zero.

A major drawback is that a change in the position of one control point needs

recalculation of all coefficients. This is solved by specifying the tangent at

each control point. Then, a change in position of one point affects only two

sections of the curve. This is called Hermite interpolation.

, ,u x u y u z uP

kp

1kp

1 1

0 0

1 1k k

k k

P p P Dp

P p P Dp

is parametric derivative (curve slope).kDp

June 2010 4

3 2

3 2

There is , 0 1. The component of is

and similarily for and .x x

u u u u u x u

x u a u b u cu d y z

P a b c d P

3 2 21 , 3 2 1 0u u u u u u u

a a

b bP P

c c

d d

1 1

1 1

0 0 0 1 2 2 1 1

1 1 1 1 3 3 2 1

0 0 1 0 0 0 1 0

3 2 1 0 1 0 0 0

k k

k k

k k

k k

H

p pa a

p pb b

Dp Dpc c

Dp Dpd d

M

The inverse boundary constraints matrix is called matrix.HM Hermite

June 2010 5

1

13 2

1

3 2 3 21

3 2 3 21

0 1

2 3

The curve segment between the constraint points and is therefore

1

2 3 1 2 3

2

k k

k

kH

k

k

k k

k k

H u H u

H u H u

u u u u

u u u u

u u u u u

p p

p

pP M

Dp

Dp

p p

Dp Dp

, 0,1,2,3, are callediH u i

Hermite Blending Functions.

0H 1H

3H

4H

June 2010 6

Other Splines

The requirements of curve derivative values control point may be a problem.

Instead, the derivatives can naturally be defined based on the control points.

In Cardinal splines a curve section is completely defined by the position of

four consecutive points.

1k p

kp1kp

2kp

1 1

1 2

10 , 0 1 ,

2

11 , 0 1 .

2

is called parameter, controlling how

loosely or tightly it fits the control points.

k k k

k k k

t

t

t

P p P p p

P p P p p

tension

June 2010 7

t < 0: looser curve t > 0: tighter curve

Cardinal matrix and blending functions are derived similarly as in Hermite

splines. Setting s=(1-t)/2

June 2010 8

1

3 2

1

2

3 2 3 21

10

3 21

2

2 2

2 3 3 21

0 0

0 1 0 0

2 2 3 1

CARCAR

2 3 2

CAR

k

k

k

k

C

k k

k

s s s s

s s s su u u u

s s

su su su s u s u

uu

s u s u su

u

p

pP

p

p

M

p p

p

3 22

3CAR

k su su

u

p

CAR , 0,1,2,3, are called i u i Cardinal Blending Functions.

June 2010 9

There are few more splines with more parameters than tension, designed

to model animation paths with abrupt changes in motion.

June 2010 10

Bezier Spline Curves

Developed by Pierre Bezier at Renault corporation for the design of automobile

bodies. Bezier splines are very useful for design of curves and surfaces.

0

,0

,

Let , , , 0 , be 1 control points, blended

to create a position vector describing a path from to .

BEZ , 0 1, where

!BEZ , 1 , ,

! !

k k k k

n

n

k k nk

n kkk n

x y z k n n

u

u u u

nu C n k u u C n k

k n k

p

P p p

P p

Bezier curve is a polynomial of degree one less the number of control points.

Coefficients and blending functions satisfy recursive relations as follows:

June 2010 11

, , 1 1, 1

, 0,

1, , 1 ,

BEZ 1 BEZ BEZ , 1, with

BEZ and BEZ 1 .

k n k n k n

kkk k k

n kC n k C n k n k

k

u u u u u n k

u u u u

0p 2p

1p 1p 2p

3p0p0p 7p

June 2010 12

Properties of Bezier Curves

0

A useful property is that the curve connects to first and last control

points: 0 , 1 .n P p P p

0 1 1

The parametric derivative at the end control points is given by:

0 , 1 .

The slope of the cure at the end points is along the line joining the

last two end points.

n nn n n n P p p P p p

2 1 1 0

2 1 1

The parametric second derivatives is given by:

0 1 ,

1 1 ,n n n n

n n

n n

P p p p p

P p p p p

June 2010 13

,

Another important property of any Bezier curve is its containment in the

convex hall of the control point. This follows from being a positive

sum of the control points where sum of weights is BEZk n

uP

0

1.n

ku

Cubic Bezier Curves

Bezier curves with many points are expensive to compute due to high degree

of polynomials. It is common to “patch” curves of four points and construct it

from piecewise cubic curves.

3 2 2 30,3 1,3 2,3 3,3BEZ 1 , BEZ 3 1 , BEZ 3 1 , BEZ .u u u u u u

The following illustrates the four blending functions and how they relate to

various curves.

June 2010 14

June 2010 15

0

13 2

2

3

Bez

1 3 3 1

Polynomial 3 6 3 0 1

expansion yields: 3 3 0 0

1 0 0 0

u u u u

p

pP

p

p

M

Complex curves can be constructed by patching cubic Bezier splines. Given

two control points, in order to obtain C1 continuity of the patch a new point

is introduced and its position is defined by equation the expression of first

derivative for u=1 with the next one for u=0. If C2 continuity is desired, a

second point is introduces and the expressions of the second derivatives are

also equated.

June 2010 16

Displaying Spline Curves and Surfaces

We must determine positions of points on curves and surfaces for displaying

those. Parametric polynomial splines must be calculated by steps increments

over range of parameter, e.g. [0,1]. This is very time consuming and efficient

computations methods are in order.

3 2Consider a cubic spline . Applying

requires 4 additions

and 3 multiplications. This must be repeared for every displayed

point, which is ver

x x x x

x x x x

x u a u b u c u d

x u a u b u c u d

Horner's rule

y expensive.

A method called Forward-Difference is very efficient and requires mostly

additions.

June 2010 17

0 1

1 1

3 2

1

3 2

Let us increase 0,1 in steps 0, , 0,1, 2,

This results corresponding increments in . Substitution

of in yields:

k k

k k k

k

k x k x k x k x

x k x k x k x

k

u u u u k

x x x x

u x u

x a u b u c u d

a u b u c u d

x

2 2 3 2

1

3 3 2x k x x k x x x

k

a u a b u a b c

x

1 1 1 1 2

1

2 2 3 21

21

3 2

2

is quadratic polynomial of . . Substitution

of in yields

= 3

6 6 2

3 2

k k k k

k k

k k x k

x k x x

k

x x k x x x

k k

x u x x x

u x

x u a u a b u a b c

x u a u a b

x

June 2010 18

2

23

3

3 22

Similarily,

6 6 2 6k k x k x x k x

k

ax u a u a b x

x

3 20 0 0 1 0

3 2 32 0

At there exists 0. Hence , ,

6 2 and 6 .

x x x x

x x x

x u x d x a b c

x a b a

1 0 1 2 1 1 2 3 2 1 2 3

4 1 1

3 1 2 3

Then , , and .

can be derived from by considering as a starting point

and progressing with 3 forward differences.

Hence 3 2 , requiring only 3 addi i

x x x x x x

x x x

x x

itions for

eavery new point.