80
Geometric Modeling Summer Semester 2012 Rational Spline Curves Projective Geometry · Rational Bezier Curves · NURBS

Geometric Modeling - Max Planck Societyresources.mpi-inf.mpg.de/.../12_Rational_Splines.pdfRational Bezier Curves Rational Bezier curves in n of degree d: •Form a Bezier curve of

  • Upload
    others

  • View
    9

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Geometric Modeling - Max Planck Societyresources.mpi-inf.mpg.de/.../12_Rational_Splines.pdfRational Bezier Curves Rational Bezier curves in n of degree d: •Form a Bezier curve of

Geometric Modeling Summer Semester 2012

Rational Spline Curves Projective Geometry · Rational Bezier Curves · NURBS

Page 2: Geometric Modeling - Max Planck Societyresources.mpi-inf.mpg.de/.../12_Rational_Splines.pdfRational Bezier Curves Rational Bezier curves in n of degree d: •Form a Bezier curve of

Overview...

Topics:

• Polynomial Spline Curves

• Blossoming and Polars

• Rational Spline Curves

Some projective geometry

Conics and quadrics

Rational Bezier Curves

Rational B-Splines: NURBS

• Spline Surfaces

Page 3: Geometric Modeling - Max Planck Societyresources.mpi-inf.mpg.de/.../12_Rational_Splines.pdfRational Bezier Curves Rational Bezier curves in n of degree d: •Form a Bezier curve of

Some Projective Geometry

Page 4: Geometric Modeling - Max Planck Societyresources.mpi-inf.mpg.de/.../12_Rational_Splines.pdfRational Bezier Curves Rational Bezier curves in n of degree d: •Form a Bezier curve of

Projective Geometry

A very short overview of projective geometry

• The computer graphics perspective

• Formal definition

Page 5: Geometric Modeling - Max Planck Societyresources.mpi-inf.mpg.de/.../12_Rational_Splines.pdfRational Bezier Curves Rational Bezier curves in n of degree d: •Form a Bezier curve of

Homogeneous Coordinates

Problem:

• Linear maps (matrix multiplication in d) can represent...

Rotations

Scaling

Sheering

Orthogonal projections

• ...but not:

Translations

Perspective projections

• This is a problem in computer graphics:

We would like to represent compound operations in a single, closed representation

Page 6: Geometric Modeling - Max Planck Societyresources.mpi-inf.mpg.de/.../12_Rational_Splines.pdfRational Bezier Curves Rational Bezier curves in n of degree d: •Form a Bezier curve of

Translations

“Quick Hack” #1: Translations

• Linear maps cannot represent translations:

Every linear map maps the zero vector to zero M0 = 0

Thus, non-trivial translations are non-linear

• Solution:

Add one dimension to each vector

Fill in a one

Now we can do translations by adding multiples of the one:

111002212

2111

2212

2111

y

x

y

x

t

t

y

x

rr

rr

y

x

trr

trr

Mx

Page 7: Geometric Modeling - Max Planck Societyresources.mpi-inf.mpg.de/.../12_Rational_Splines.pdfRational Bezier Curves Rational Bezier curves in n of degree d: •Form a Bezier curve of

Normalization

Problem: What if the last entry is not 1?

• It’s not a bug, it’s a feature...

• If the last component is not 1, divide everything by it before using the result

xx

Cartesian coordinates (Euclidian space)

homogenous coordinates (projective space)

xx

1

Page 8: Geometric Modeling - Max Planck Societyresources.mpi-inf.mpg.de/.../12_Rational_Splines.pdfRational Bezier Curves Rational Bezier curves in n of degree d: •Form a Bezier curve of

Notation

Notation:

• The extra component is called the homogenous component of the vector.

• It is usually denoted by : 2D case:

General case:

y

x

y

x

z

y

x

z

y

x

3D case:

xx

Page 9: Geometric Modeling - Max Planck Societyresources.mpi-inf.mpg.de/.../12_Rational_Splines.pdfRational Bezier Curves Rational Bezier curves in n of degree d: •Form a Bezier curve of

Perspective Projections

New Feature: Perspective projections

• Very useful for 3D computer graphics

• Perspective projection (central projection)

involves divisions

can be packaged into homogeneous component

pinhole camera object image

Page 10: Geometric Modeling - Max Planck Societyresources.mpi-inf.mpg.de/.../12_Rational_Splines.pdfRational Bezier Curves Rational Bezier curves in n of degree d: •Form a Bezier curve of

Perspective Projection

Physical camera:

Virtual camera: pinhole camera object image

center of projection object image plane

Page 11: Geometric Modeling - Max Planck Societyresources.mpi-inf.mpg.de/.../12_Rational_Splines.pdfRational Bezier Curves Rational Bezier curves in n of degree d: •Form a Bezier curve of

Perspective Projection

center of projection object image plane

yx,

',' yx

d

z

z

ydy

z

xdx ','Perpective projection:

Page 12: Geometric Modeling - Max Planck Societyresources.mpi-inf.mpg.de/.../12_Rational_Splines.pdfRational Bezier Curves Rational Bezier curves in n of degree d: •Form a Bezier curve of

Homogenous Transformation

Projection as linear transformation in homogenous coordinates:

• Trick: Put the denominator into the component.

• Camera placement: move scene in opposite direction

z

ydy

z

xdx ','

z

y

x

d

d

d

z

y

x

0100

000

000

000

'

'

'

'

Page 13: Geometric Modeling - Max Planck Societyresources.mpi-inf.mpg.de/.../12_Rational_Splines.pdfRational Bezier Curves Rational Bezier curves in n of degree d: •Form a Bezier curve of

Graphics Pipeline

Graphics pipeline:

perspective divide

rasterization

projection camera

placement object

movement

3d object (polygon)

vertices xi

x Mm·x x Mc·x x Mp·x x x/x.

2d image

bitmap image

Homogenous coordinates

Page 14: Geometric Modeling - Max Planck Societyresources.mpi-inf.mpg.de/.../12_Rational_Splines.pdfRational Bezier Curves Rational Bezier curves in n of degree d: •Form a Bezier curve of

OpenGL Graphics Pipeline

Example: OpenGL Pipeline

• Polygon primitives (triangles)

• Vertices specified by homogenous coordinates (4 floats)

• Transformation pipeline:

Corresponds to a 4x4 matrix transformation

(more or less; clipping etc. separate)

• Hardware accelerated

Special purpose hardware

Supports rapid 4D vector operations (“vertex shader”)

Page 15: Geometric Modeling - Max Planck Societyresources.mpi-inf.mpg.de/.../12_Rational_Splines.pdfRational Bezier Curves Rational Bezier curves in n of degree d: •Form a Bezier curve of

Formal Definition

Projective Space Pd:

• Embed Euclidian space Ed

into d+1 dimensional Euclidian space at = 1

Additional dimension usually named

• Identify all points on lines through the origin

representing the same Euclidian point

E1 P1

0

p E1

p’ P1

0,'

pp

E2 P2

0

p’ P2

0,'

pp

p E2

Page 16: Geometric Modeling - Max Planck Societyresources.mpi-inf.mpg.de/.../12_Rational_Splines.pdfRational Bezier Curves Rational Bezier curves in n of degree d: •Form a Bezier curve of

Properties

Properties:

• Points represented by lines through the origin

• Consequence:

scaling by common factor does not change the point

Euclidian( x) = Euclidian(x), 0

We can scale the points arbitrarily

• Hence:

When multiple projective operations are performed on the projective points.

Division by can be done at any time

• “Projective transformation”:

Map lines through the origin to lines through the origin

Page 17: Geometric Modeling - Max Planck Societyresources.mpi-inf.mpg.de/.../12_Rational_Splines.pdfRational Bezier Curves Rational Bezier curves in n of degree d: •Form a Bezier curve of

Properties

Projective Maps:

• Represented by linear maps in the higher dimensional space

• Scale at any time:

Important: We have , but in general:

)0(for .

ˆ.

ˆ x

xM

y

MxMxy

xx ̂ yxyx ˆ

Page 18: Geometric Modeling - Max Planck Societyresources.mpi-inf.mpg.de/.../12_Rational_Splines.pdfRational Bezier Curves Rational Bezier curves in n of degree d: •Form a Bezier curve of

Directions

Problem: What if = 0?

• Again – it’s not a bug, it’s a feature

• Projective points with = 0 do not correspond to Euclidian points

• They represent directions, or points at infinity.

• This gives a natural distinction:

Euclidian points: 0 in homogenous coordinates.

Euclidian vectors: = 0 in homogenous coordinates.

• The difference of points yields a vector.

Vectors can be added to points

But not (not really) points to points.

Page 19: Geometric Modeling - Max Planck Societyresources.mpi-inf.mpg.de/.../12_Rational_Splines.pdfRational Bezier Curves Rational Bezier curves in n of degree d: •Form a Bezier curve of

Quadrics and Conics

Page 20: Geometric Modeling - Max Planck Societyresources.mpi-inf.mpg.de/.../12_Rational_Splines.pdfRational Bezier Curves Rational Bezier curves in n of degree d: •Form a Bezier curve of

Modeling Wish List

We want to model:

• Circles (Surfaces: Spheres)

• Ellipses (Surfaces: Ellipsoids)

• And segments of those

• Surfaces: Objects with circular cross section

Cylinders

Cones

Surfaces of revolution (lathing)

These objects cannot be represented exactly (only approximated) by piecewise polynomials

Page 21: Geometric Modeling - Max Planck Societyresources.mpi-inf.mpg.de/.../12_Rational_Splines.pdfRational Bezier Curves Rational Bezier curves in n of degree d: •Form a Bezier curve of

Conical Sections

Classic description of such objects:

• Conical sections (conics)

• Intersections of a cone and a plane

• Resulting objects:

Circles

Ellipses

Hyperbolas

Parabolas

Points

Lines

Page 22: Geometric Modeling - Max Planck Societyresources.mpi-inf.mpg.de/.../12_Rational_Splines.pdfRational Bezier Curves Rational Bezier curves in n of degree d: •Form a Bezier curve of

Conic Sections

Circle, Ellipse

Hyperbola Parabola Line (degenerate case)

Point (degenerate case)

Page 23: Geometric Modeling - Max Planck Societyresources.mpi-inf.mpg.de/.../12_Rational_Splines.pdfRational Bezier Curves Rational Bezier curves in n of degree d: •Form a Bezier curve of

Implicit Form

Implicit quadrics:

• Conic sections can be expressed as zero set of a quadratic function:

• Easy to see why:

021

21

0

T

22

fedcb

ba

fyexdycxybxa

xxx

222 zByAx

FEyDxz

Implicit eq. for a cone:

Explicit eq. for a plane:

222 FEyDxByAx Conical Section:

Page 24: Geometric Modeling - Max Planck Societyresources.mpi-inf.mpg.de/.../12_Rational_Splines.pdfRational Bezier Curves Rational Bezier curves in n of degree d: •Form a Bezier curve of

Quadrics & Conics

Quadrics:

• Zero sets of quadratic functions (any dimension) are called quadrics:

• Conics are the special case for d = 2.

0| TT cxbMxxx

Page 25: Geometric Modeling - Max Planck Societyresources.mpi-inf.mpg.de/.../12_Rational_Splines.pdfRational Bezier Curves Rational Bezier curves in n of degree d: •Form a Bezier curve of

Shapes of Quadratic Polynomials

1 = 1, 2 = 1 1 = 1, 2 = -1 1 = 1, 2 = 0

Page 26: Geometric Modeling - Max Planck Societyresources.mpi-inf.mpg.de/.../12_Rational_Splines.pdfRational Bezier Curves Rational Bezier curves in n of degree d: •Form a Bezier curve of

The Iso-Lines: Quadrics

1 > 0, 2 > 0 1 < 0, 2 > 0

elliptic hyperbolic

1 = 0, 2 0

degenerate case

Page 27: Geometric Modeling - Max Planck Societyresources.mpi-inf.mpg.de/.../12_Rational_Splines.pdfRational Bezier Curves Rational Bezier curves in n of degree d: •Form a Bezier curve of

Characterization

Determining the type of Conic from the implicit form:

• Implicit function: quadratic polynomial

• Eigenvalues of M:

021

21

0

T

22

fedcb

ba

fyexdycxybxa

xxx

M

222|1

2

1

2bca

ca

Page 28: Geometric Modeling - Max Planck Societyresources.mpi-inf.mpg.de/.../12_Rational_Splines.pdfRational Bezier Curves Rational Bezier curves in n of degree d: •Form a Bezier curve of

Cases

We obtain the following cases:

• Ellipse:

Circle:

Otherwise: general ellipse

• Hyperbola:

• Parabola: (border case)

022 fyexdycxybxa

implicit function:

acb 42

cab ,0

acb 42

acb 42

Page 29: Geometric Modeling - Max Planck Societyresources.mpi-inf.mpg.de/.../12_Rational_Splines.pdfRational Bezier Curves Rational Bezier curves in n of degree d: •Form a Bezier curve of

Cases

Explanation: 022 fyexdycxybxa

implicit function:

},0{

22

2

1

2

22

1

2

422

42

1

2

2

22

22

22|1

ca

caca

caca

cacaca

accacaca

accaca

acb 42

Page 30: Geometric Modeling - Max Planck Societyresources.mpi-inf.mpg.de/.../12_Rational_Splines.pdfRational Bezier Curves Rational Bezier curves in n of degree d: •Form a Bezier curve of

Parametrization

We want to represent conics with parametric curves:

• How can we represent (pieces) of conics as parametric curves?

• How can we generalize our framework of piecewise polynomial curves to include conical sections?

Projections of Parabolas:

• We will look at a certain class of parametric functions – projections of parabolas.

• This class turns out to be general enough,

• and can be expressed easily with the tools we know.

Page 31: Geometric Modeling - Max Planck Societyresources.mpi-inf.mpg.de/.../12_Rational_Splines.pdfRational Bezier Curves Rational Bezier curves in n of degree d: •Form a Bezier curve of

Projections of Parabolas

Definition: Projection of a Parabola

• We start with a quadratic space curve.

• Interpret the z-coordinate as homogenous component .

• Project the curve on the plane = 1.

x y

z =

= 1

Page 32: Geometric Modeling - Max Planck Societyresources.mpi-inf.mpg.de/.../12_Rational_Splines.pdfRational Bezier Curves Rational Bezier curves in n of degree d: •Form a Bezier curve of

Projected Parabola

Formal Definition:

• Quadratic polynomial curve in three space

• Project by dividing by third coordinate

.

.

.

.

.

.

.

.

.

)(

2

2

2

2

1

1

1

0

0

0

22

10)(

p

p

p

p

p

p

p

p

p

pppf y

x

ty

x

ty

x

ttthom

...

.

.

.

.

.

.

)(2

210

2

22

1

1

0

0

)(

ppp

p

p

p

p

p

p

ftt

y

xt

y

xt

y

x

teucl

Page 33: Geometric Modeling - Max Planck Societyresources.mpi-inf.mpg.de/.../12_Rational_Splines.pdfRational Bezier Curves Rational Bezier curves in n of degree d: •Form a Bezier curve of

Bernstein Basis

Alternatively: Represent in Bernstein basis

• Rational quadratic Bezier curves:

2)2(

21)2(

10)2(

0)( )()()()( pppf tBtBtBthom

.)(.)(.)(

.

.)(

.

.)(

.

.)(

)(2

)2(21

)2(10

)2(0

2

2)2(2

1

1)2(1

0

0)2(0

)(

ppp

p

p

p

p

p

p

ftBtBtB

y

xtB

y

xtB

y

xtB

teucl

Page 34: Geometric Modeling - Max Planck Societyresources.mpi-inf.mpg.de/.../12_Rational_Splines.pdfRational Bezier Curves Rational Bezier curves in n of degree d: •Form a Bezier curve of

Properties

Projective invariance:

• Quadratic Bezier curves are invariant under projective maps

• The following operations yield the same result

Applying a projective map to the control points, then evaluate the curve

Applying the same projective map to the curve

• Proof:

3D curve is invariant under linear maps

Scaling does not matter for projections (divide by before or after applying a projection matrix does not matter)

Page 35: Geometric Modeling - Max Planck Societyresources.mpi-inf.mpg.de/.../12_Rational_Splines.pdfRational Bezier Curves Rational Bezier curves in n of degree d: •Form a Bezier curve of

Parametrizing Conics

Conics can be parameterized using projected parabolas:

• We show that we can represent (piecewise):

Points and lines (obvious )

A unit parabola

A unit circle

A unit hyperbola

• General cases (ellipses etc.) can be obtained by affine mappings of the control points (which leads to affine maps of the curve)

Page 36: Geometric Modeling - Max Planck Societyresources.mpi-inf.mpg.de/.../12_Rational_Splines.pdfRational Bezier Curves Rational Bezier curves in n of degree d: •Form a Bezier curve of

Parametrizing Parabolas

Parabolas as rational parametric curves:

2

2

)(

001

1

0

0

1

0

0

)(tt

tt

teucl

f

2)(

)(

tty

ttx(pretty obvious

as well)

Page 37: Geometric Modeling - Max Planck Societyresources.mpi-inf.mpg.de/.../12_Rational_Splines.pdfRational Bezier Curves Rational Bezier curves in n of degree d: •Form a Bezier curve of

Circle

Let’s try to find a rational parametrization of a (piece of a) unit circle:

2

2

2

)(

22

2

)(

1

21

1

)(2

tan:

2tan1

2tan2

sin,

2tan1

2tan1

cos

sin

cos)(

t

tt

t

t eucl

eucl

f

f

(tangent half-angle formula)

Page 38: Geometric Modeling - Max Planck Societyresources.mpi-inf.mpg.de/.../12_Rational_Splines.pdfRational Bezier Curves Rational Bezier curves in n of degree d: •Form a Bezier curve of

Circle

Let’s try to find a rational parametrization of a (piece of a) unit circle:

2tan: with

1

21

1

sin

cos)(

2

2

2

)(

t

t

tt

t

euclf

1

2

1

)(2

2

)(

t

t

t

thomf parametrization for (-90°..90°)

we need at least three segments to parametrize a full circle

Page 39: Geometric Modeling - Max Planck Societyresources.mpi-inf.mpg.de/.../12_Rational_Splines.pdfRational Bezier Curves Rational Bezier curves in n of degree d: •Form a Bezier curve of

Hyperbolas

Unit Circle:

Unit Hyperbola:

122 yx

122 yx

22

2

1

2)(,

1

1)(

t

tty

t

ttx

22

2

1

2)(,

1

1)(

t

tty

t

ttx

(t )

(t [0..1) )

Page 40: Geometric Modeling - Max Planck Societyresources.mpi-inf.mpg.de/.../12_Rational_Splines.pdfRational Bezier Curves Rational Bezier curves in n of degree d: •Form a Bezier curve of

Rational Bezier Curves

Page 41: Geometric Modeling - Max Planck Societyresources.mpi-inf.mpg.de/.../12_Rational_Splines.pdfRational Bezier Curves Rational Bezier curves in n of degree d: •Form a Bezier curve of

Rational Bezier Curves

Rational Bezier curves in n of degree d:

• Form a Bezier curve of degree d in n+1-dimensional space

• Interpret last coordinate as homogenous component

• Euclidian coordinates are obtained by projection.

n

i

ni

di

n

i ni

idi

eucl

ni

n

ii

di

hom

ptB

p

p

tB

t

tBt

0

)1()(

0 )(

)1(

)(

)(

1

0

)()(

)(

)(

)(

,)()(

f

ppf

Page 42: Geometric Modeling - Max Planck Societyresources.mpi-inf.mpg.de/.../12_Rational_Splines.pdfRational Bezier Curves Rational Bezier curves in n of degree d: •Form a Bezier curve of

More Convenient Notation

The curve can be written in “weighted points” form:

Interpretation:

• Points are weighted by weights i

• Normalized by interpolated weights in the denominator

• Larger weights more influence of that point

n

ii

di

n

in

idi

eucl

tB

p

p

tB

t

0

)(

0

1)(

)(

)(

)(

)(

f

Page 43: Geometric Modeling - Max Planck Societyresources.mpi-inf.mpg.de/.../12_Rational_Splines.pdfRational Bezier Curves Rational Bezier curves in n of degree d: •Form a Bezier curve of

Properties

What about affine invariance, convex hull prop.?

with

Consequence:

• Affine invariance still holds

• For strictly positive weights:

Convex hull property still holds

This is not a big restriction (potential singularities otherwise)

• Projective invariance (projective maps, hom. coord’s)

n

iiin

ii

di

n

iii

di

eucl tq

tB

tB

t0

0

)(

0

)(

)( )(

)(

)(

)( p

p

f

1)(0

n

ii tq

Page 44: Geometric Modeling - Max Planck Societyresources.mpi-inf.mpg.de/.../12_Rational_Splines.pdfRational Bezier Curves Rational Bezier curves in n of degree d: •Form a Bezier curve of

Quadratic Bezier Curves

Quadratic curves:

• Necessary and sufficient to represent conics

• Therefore, we will examine them closer...

Quadratic rational Bezier curve:

i

ni

eucl

tBtBtB

tBtBtBt

,,

)()()(

)()()()(

2)2(

21)2(

10)2(

0

22)2(

211)2(

100)2(

0)(p

pppf

Page 45: Geometric Modeling - Max Planck Societyresources.mpi-inf.mpg.de/.../12_Rational_Splines.pdfRational Bezier Curves Rational Bezier curves in n of degree d: •Form a Bezier curve of

Standard Form

How many degrees of freedom are in the weights?

• Quadratic rational Bezier curve:

• If one of the weights is 0 (which must be the case), we can divide numerator and denominator by this weight and thus remove one degree of freedom.

• If we are only interested in the shape of the curve, we can remove one more degree of freedom by a reparametrization...

2)2(

21)2(

10)2(

0

22)2(

211)2(

100)2(

0)(

)()()(

)()()()(

tBtBtB

tBtBtBteucl

pppf

Page 46: Geometric Modeling - Max Planck Societyresources.mpi-inf.mpg.de/.../12_Rational_Splines.pdfRational Bezier Curves Rational Bezier curves in n of degree d: •Form a Bezier curve of

Standard Form

How many degrees of freedom are in the weights?

• Concerning the shape of the curve, the parametrization does not matter.

• We have:

• We set: (with to be determined later)

22

102

222

11002

)(

)1(2)1(

)1(2)1()(

tttt

ttttteucl

pppf

tt

ttei

tt

tt ~

)~

1(

~1

1.,.,~)

~1(

~

Page 47: Geometric Modeling - Max Planck Societyresources.mpi-inf.mpg.de/.../12_Rational_Splines.pdfRational Bezier Curves Rational Bezier curves in n of degree d: •Form a Bezier curve of

Remark: Why this reparametrization?

Properties:

• 0 0, 1 1, monotonic in between

• Shape determined by parameter .

1

tt

tt ~

)~

1(

~

20

20

1 1Reparametrization:

0 0 1 0.5

0.5

Page 48: Geometric Modeling - Max Planck Societyresources.mpi-inf.mpg.de/.../12_Rational_Splines.pdfRational Bezier Curves Rational Bezier curves in n of degree d: •Form a Bezier curve of

Standard Form

2)2(

21)2(

10)2(

02

22)2(

211)2(

100)2(

02

22

10

22

222

1100

22

2

2

10

2

22

2

1100

2

)(

)~

()~

()~

(

)~

()~

()~

(

~~1

~2

~1

~~1

~2

~1

~)

~1(

~

~)

~1(

~1

~)

~1(

~

2~)

~1(

~1

~)

~1(

~

~)

~1(

~1

~)

~1(

~

2~)

~1(

~1

)(

~)

~1(

~1

1.,.,~)

~1(

~

tBtBtB

tBtBtB

tttt

tttt

tt

t

tt

t

tt

t

tt

t

tt

t

tt

t

tt

t

tt

t

t

tt

ttei

tt

tt

eucl

ppp

ppp

ppp

f

Page 49: Geometric Modeling - Max Planck Societyresources.mpi-inf.mpg.de/.../12_Rational_Splines.pdfRational Bezier Curves Rational Bezier curves in n of degree d: •Form a Bezier curve of

Standard Form

2)2(

21)2(

10)2(

02

22)2(

211)2(

100)2(

02

22

10

22

222

1100

22

2

2

10

2

22

2

1100

2

)(

)~

()~

()~

(

)~

()~

()~

(

~~1

~2

~1

~~1

~2

~1

~)

~1(

~

~)

~1(

~1

~)

~1(

~

2~)

~1(

~1

~)

~1(

~

~)

~1(

~1

~)

~1(

~

2~)

~1(

~1

)(

~)

~1(

~1

1.,.,~)

~1(

~

tBtBtB

tBtBtB

tttt

tttt

tt

t

tt

t

tt

t

tt

t

tt

t

tt

t

tt

t

tt

t

t

tt

ttei

tt

tt

eucl

ppp

ppp

ppp

f

Page 50: Geometric Modeling - Max Planck Societyresources.mpi-inf.mpg.de/.../12_Rational_Splines.pdfRational Bezier Curves Rational Bezier curves in n of degree d: •Form a Bezier curve of

Standard Form

)~

()~

()~

(

)~

()~

()~

(

)~

()~

()~

(

)~

()~

()~

(

)(

)0 (assume let

)2(221

0

2)2(12

)2(0

2)2(

221

0

2)2(102

)2(0

)2(221

0

2)2(10

2

0

2)2(0

2)2(

2211

0

2)2(100

2

0

2)2(0

)(

0

2

0

2

tBtBtB

tBtBtB

tBtBtB

tBtBtB

t

ω

ω

eucl

ppp

ppp

f

2)2(

21)2(

10)2(

02

22)2(

211)2(

100)2(

02

)(

)~

()~

()~

(

)~

()~

()~

()(

tBtBtB

tBtBtBteucl

pppf

Page 51: Geometric Modeling - Max Planck Societyresources.mpi-inf.mpg.de/.../12_Rational_Splines.pdfRational Bezier Curves Rational Bezier curves in n of degree d: •Form a Bezier curve of

Standard Form

)~

()~

()~

(

)~

()~

()~

(

)~

()~

()~

(

)~

()~

()~

(

)(

)0 (assume let

)2(221

0

2)2(12

)2(0

2)2(

2211

0

2)2(102

)2(0

)2(221

0

2)2(10

2

0

2)2(0

2)2(

2211

0

2)2(100

2

0

2)2(0

)(

0

2

0

2

tBtBtB

tBtBtB

tBtBtB

tBtBtB

t

ω

ω

eucl

ppp

ppp

f

2)2(

21)2(

10)2(

02

22)2(

211)2(

100)2(

02

)(

)~

()~

()~

(

)~

()~

()~

()(

tBtBtB

tBtBtBteucl

pppf

Page 52: Geometric Modeling - Max Planck Societyresources.mpi-inf.mpg.de/.../12_Rational_Splines.pdfRational Bezier Curves Rational Bezier curves in n of degree d: •Form a Bezier curve of

Standard Form

10

2)2(

2)2(

1)2(

0

2)2(

21)2(

10)2(

0

)2(21

20

)2(1

)2(0

2)2(

21120

)2(10

)2(0

)2(221

0

2)2(12

)2(0

2)2(

22110

2)2(102

)2(0

)(

: :with )

~()

~()

~(

)~

()~

()~

(

)~

(1

)~

()~

(

)~

(1

)~

()~

(

)~

()~

()~

(

)~

()~

()~

(

)(

tBtBtB

tBtBtB

tBtBtB

tBtBtB

tBtBtB

tBtBtB

teucl

ppp

ppp

ppp

f

Page 53: Geometric Modeling - Max Planck Societyresources.mpi-inf.mpg.de/.../12_Rational_Splines.pdfRational Bezier Curves Rational Bezier curves in n of degree d: •Form a Bezier curve of

Standard Form

120

)2(2

)2(1

)2(0

2)2(

21)2(

10)2(

0

)2(21

20

)2(1

)2(0

2)2(

21120

)2(10

)2(0

)2(221

0

2)2(12

)2(0

2)2(

22110

2)2(102

)2(0

)(

1: :with

)~

()~

()~

(

)~

()~

()~

(

)~

(1

)~

()~

(

)~

(1

)~

()~

(

)~

()~

()~

(

)~

()~

()~

(

)(

tBtBtB

tBtBtB

tBtBtB

tBtBtB

tBtBtB

tBtBtB

teucl

ppp

ppp

ppp

f

Page 54: Geometric Modeling - Max Planck Societyresources.mpi-inf.mpg.de/.../12_Rational_Splines.pdfRational Bezier Curves Rational Bezier curves in n of degree d: •Form a Bezier curve of

Standard Form

Consequence:

• It is sufficient to specify the weight of the inner point

• We can w.l.o.g. set 0 = 2 = 1, 1 =

• This form of a quadratic Bezier curve is called the standard form.

• Choices:

< 1: ellipse segment

= 1: parabola segment (non-rational curve)

> 1: hyperbola segment

Page 55: Geometric Modeling - Max Planck Societyresources.mpi-inf.mpg.de/.../12_Rational_Splines.pdfRational Bezier Curves Rational Bezier curves in n of degree d: •Form a Bezier curve of

Illustration

Changing the weight:

p(0,0) p(1,1)

p(0,1)

< 1

> 1

= 1

Hyperbola

Parabola

Ellipse

Page 56: Geometric Modeling - Max Planck Societyresources.mpi-inf.mpg.de/.../12_Rational_Splines.pdfRational Bezier Curves Rational Bezier curves in n of degree d: •Form a Bezier curve of

Conversion to Implicit Form

Convert parametric to implicit form:

• In order to show the shape conditions

• For distance computations / inside-outside tests

Express curve in barycentric coordinates:

• Curve can be expressed in barycentric coordinates (linear transform):

p0

p1

p2

p(t)

0

1

2

221100 )()()()( pppf tttt

Page 57: Geometric Modeling - Max Planck Societyresources.mpi-inf.mpg.de/.../12_Rational_Splines.pdfRational Bezier Curves Rational Bezier curves in n of degree d: •Form a Bezier curve of

Conversion to Implicit Form

Comparison of coefficients yields:

p0

p1

p2

f(t)

0

1

2

)()(

)()(

)(

)1(2

)(

)()(

)(

)1(

)(

)()(

22

2

0

)2(

)2(22

2

12

0

)2(

)2(11

1

20

:

2

0

)2(

)2(00

0

tD

t

tB

tBt

tD

tt

tB

tBt

tD

t

tB

tBt

iii

iii

D

iii

221100 )()()()( pppf tttt

22

102

222

11002

)(

)1(2)1(

)1(2)1()(

tttt

ttttteucl

pppf

Page 58: Geometric Modeling - Max Planck Societyresources.mpi-inf.mpg.de/.../12_Rational_Splines.pdfRational Bezier Curves Rational Bezier curves in n of degree d: •Form a Bezier curve of

Conversion to Implicit Form

Solving for t, (1-t):

2

22

22

11

0

02

00

)()(

)()(

)(

)1(2)(

)()()1(

)(

)1()(

tDtt

tD

tt

tD

ttt

tDtt

tD

tt

20

21

02

21

20

021

0

0

2

21

1

4)()(

)(

)()(2

)(

)()()()(2

)(

tt

t

tt

tD

tDttDt

t

p0

p1

p2

f(t)

0

1

2

Page 59: Geometric Modeling - Max Planck Societyresources.mpi-inf.mpg.de/.../12_Rational_Splines.pdfRational Bezier Curves Rational Bezier curves in n of degree d: •Form a Bezier curve of

Conversion to Implicit Form

Some more algebra...:

20

21

02

21 4

)()(

)(

tt

t

p0

p1

p2

f(t)

0

1

2

)()()()(4

)()(1)(4

)()(4)(

012

00

2

1

100

2

1

02

2

12

120

tttt

ttt

ttt

Using we get: )()(1)( 102 ttt

0)(4)(4)()(4)( 02

12

02

1012

12

120 ttttt

a x2 + b xy + c y2 + e x + 0y + 0 = 0

(transformed coordinates: x,y affine transform of std coords; does not matter for shape type)

Page 60: Geometric Modeling - Max Planck Societyresources.mpi-inf.mpg.de/.../12_Rational_Splines.pdfRational Bezier Curves Rational Bezier curves in n of degree d: •Form a Bezier curve of

Classification

Eigenvalue argument led to:

• Parabola requires in

• In our case:

i.e.:

Standard form:

022 fyexdycxybxaacb 42

0)(4)(4)()(4)( 02

12

02

1012

12

120 ttttt

2120

41

2120

221

2120

1616

444

120

11

Page 61: Geometric Modeling - Max Planck Societyresources.mpi-inf.mpg.de/.../12_Rational_Splines.pdfRational Bezier Curves Rational Bezier curves in n of degree d: •Form a Bezier curve of

Classification

Similarly, it follows that:

11

11

11

Ellipse

Parabola

Hyperbola

120

Page 62: Geometric Modeling - Max Planck Societyresources.mpi-inf.mpg.de/.../12_Rational_Splines.pdfRational Bezier Curves Rational Bezier curves in n of degree d: •Form a Bezier curve of

Circle in Bezier Form

Quadratic rational polynomial:

)90..90(,2

tant, 2

1

1

1)(

2

2

t

t

ttf

Conversion to Bezier basis:

T2)2(2

T2)2(1

T22)2(0

100ˆ

220ˆ2212

121ˆ211

tB

ttttB

tttB T2

T

T2

101ˆ1

020ˆ2

101ˆ1

t

t

t

Page 63: Geometric Modeling - Max Planck Societyresources.mpi-inf.mpg.de/.../12_Rational_Splines.pdfRational Bezier Curves Rational Bezier curves in n of degree d: •Form a Bezier curve of

Circle in Bezier Form

Conversion to Bezier basis:

T2)2(2

T2)2(1

T22)2(0

100ˆ

220ˆ2212

121ˆ211

tB

ttttB

tttB T2

T

T2

101ˆ1

020ˆ2

101ˆ1

t

t

t

Comparison yields:

)2(2

)2(1

)2(0

2

)2(2

)2(1

)2(1

)2(0

2

21

22

1

BBBt

BBt

BBt

)2(

2)2(

1)2(

0(hom)

2

2

0

1

1

1

1

0

1

)( BBBt

f

Page 64: Geometric Modeling - Max Planck Societyresources.mpi-inf.mpg.de/.../12_Rational_Splines.pdfRational Bezier Curves Rational Bezier curves in n of degree d: •Form a Bezier curve of

Circle in Bezier Form

Result:

)(2)()(

1

0)(2

1

1)(

0

1)(

)()2(

2)2(

1)2(

0

)2(2

)2(1

)2(0

tBtBtB

tBtBtB

t

f

]90..0[]1,0[

arctan22

tant

t

t

Parameters:

Page 65: Geometric Modeling - Max Planck Societyresources.mpi-inf.mpg.de/.../12_Rational_Splines.pdfRational Bezier Curves Rational Bezier curves in n of degree d: •Form a Bezier curve of

Circle in Bezier Form

Standard Form:

)2(2

)2(1

)2(0

)2(2

)2(1

)2(0

22

1

1

0

1

12

2

1

0

1

)(

BBB

BBB

t

f

1

20)2(

2)2(

1)2(

0

2)2(

21)2(

10)2(

0 1: :with

)~

()~

()~

(

)~

()~

()~

()(

tBtBtB

tBtBtBt

pppf

Page 66: Geometric Modeling - Max Planck Societyresources.mpi-inf.mpg.de/.../12_Rational_Splines.pdfRational Bezier Curves Rational Bezier curves in n of degree d: •Form a Bezier curve of

Result: Circle in Bezier Form

Final Result:

22

11

0

12p

1

00p

12

10

1

11p

Page 67: Geometric Modeling - Max Planck Societyresources.mpi-inf.mpg.de/.../12_Rational_Splines.pdfRational Bezier Curves Rational Bezier curves in n of degree d: •Form a Bezier curve of

General Circle Segments

In general:

cos

:1 for

1

20

= 60° 1 = 0.5

angle interval < 180°

Page 68: Geometric Modeling - Max Planck Societyresources.mpi-inf.mpg.de/.../12_Rational_Splines.pdfRational Bezier Curves Rational Bezier curves in n of degree d: •Form a Bezier curve of

Properties, Remarks

Continuity:

• The parametrization is only C1, but G

• No arc length parametrization possible

• Even stronger: No rational curve other than a straight line can have an arc-length parametrization.

Circles in in general degree Bezier splines:

• Simplest solution:

Form quadratic circle (segments)

Apply degree elevation to obtain the desired degree

Page 69: Geometric Modeling - Max Planck Societyresources.mpi-inf.mpg.de/.../12_Rational_Splines.pdfRational Bezier Curves Rational Bezier curves in n of degree d: •Form a Bezier curve of

Rational De Casteljau Algorithm

Evaluation with De Casteljau Algorithm

• Two Variants:

Compute numerator and denominator separately, then divide

Divide in each intermediate step (“rational de Casteljau”)

• Non-rational de Casteljau algorithm:

• Rational de Casteljau algorithm:

)()()1()(

with

)()(

)()(

)(

)()1()(

)1(1

)1()(

)1(1)(

)1(1)1(

)(

)1()(

ttttt

tt

ttt

t

ttt

ri

ri

ri

rir

i

rir

iri

rir

i

bbb

)()()1()( )1(1

)1()( ttttt ri

ri

ri

bbb

Page 70: Geometric Modeling - Max Planck Societyresources.mpi-inf.mpg.de/.../12_Rational_Splines.pdfRational Bezier Curves Rational Bezier curves in n of degree d: •Form a Bezier curve of

Rational De Casteljau Algorithm

Advantages:

• More intuitive (repeated weighted linear interpolation of points and weights)

• Numerically more stable (only convex combinations for the standard case of positive weights, t [0,1])

Page 71: Geometric Modeling - Max Planck Societyresources.mpi-inf.mpg.de/.../12_Rational_Splines.pdfRational Bezier Curves Rational Bezier curves in n of degree d: •Form a Bezier curve of

Weight Points

Alternative technique to specify weights:

• Weight points

• User interface: More intuitive in interactive design

Weight Points:

Standard Form:

21

22111

10

11000 ,

ppq

ppq

1

2111

1

1100

1,

1

ppq

ppq

p0 p2

p1

q0

q0

q0

q1

q1

q1

1

Page 72: Geometric Modeling - Max Planck Societyresources.mpi-inf.mpg.de/.../12_Rational_Splines.pdfRational Bezier Curves Rational Bezier curves in n of degree d: •Form a Bezier curve of

Derivatives

Computing derivatives of rational Bezier curves:

• Straightforward: Apply quotient rule

• A simpler expression can be derived using an algebraic trick:

)(

)(:

)(

)(

)(

0

)(

0

)(

t

tB

tB

td

ii

di

d

iii

di

pp

f

)(

)(')()(')(')(')()(')()('

)(')()()(')(')()()()(

)()(

tωttttωtttωt

tωttωtttωtttω

tt

fpffpf

ffpfpp

f

Page 73: Geometric Modeling - Max Planck Societyresources.mpi-inf.mpg.de/.../12_Rational_Splines.pdfRational Bezier Curves Rational Bezier curves in n of degree d: •Form a Bezier curve of

Derivatives

At the endpoints:

)()1('

)(

)0(

)0()0(')0(')0('

)(

)()(')(')('

11

010

1

0001001100

0010011

ddd

d

ωd

ωd

ω

d

ω

dd

ω

ω

ttωtt

ppf

pp

ppppppp

fpf

fpf

Page 74: Geometric Modeling - Max Planck Societyresources.mpi-inf.mpg.de/.../12_Rational_Splines.pdfRational Bezier Curves Rational Bezier curves in n of degree d: •Form a Bezier curve of

NURBS: Non-Uniform Rational B-Splines

Page 75: Geometric Modeling - Max Planck Societyresources.mpi-inf.mpg.de/.../12_Rational_Splines.pdfRational Bezier Curves Rational Bezier curves in n of degree d: •Form a Bezier curve of

NURBS

NURBS: Rational B-Splines

• Same idea:

Control points in homogenous coordinates

Evaluate curve in (d+1)-dimensional space (same as before)

For display, divide by -component

– (we can divide anytime)

Page 76: Geometric Modeling - Max Planck Societyresources.mpi-inf.mpg.de/.../12_Rational_Splines.pdfRational Bezier Curves Rational Bezier curves in n of degree d: •Form a Bezier curve of

NURBS

NURBS: Rational B-Splines

• Formally: ( : B-spline basis function i of degree d)

• Knot sequences etc. all remain the same

• De Boor algorithm – similar to rational de Casteljau alg.

1. option – apply separately to numerator, denominator

2. option – normalize weights in each intermediate result

– The second option is numerically more stable

n

ii

di

n

iii

di

tN

tN

t

1

)(

1

)(

)(

)(

)(

p

f

)(diN

Page 77: Geometric Modeling - Max Planck Societyresources.mpi-inf.mpg.de/.../12_Rational_Splines.pdfRational Bezier Curves Rational Bezier curves in n of degree d: •Form a Bezier curve of

Some Issues

Interpolation problems:

• Finding a B-Spline curve that interpolates a set of homogeneous points is easy

• Just solve a linear system

• Note: The problem is easy when the weights are given.

What if no weights are given (only Euclidian points)?

• More degrees of freedom than constraints

• If we reduce the number of points:

Non-linear system of equations

Issues: How to find a solution? Does it exist? Is it unique?

Page 78: Geometric Modeling - Max Planck Societyresources.mpi-inf.mpg.de/.../12_Rational_Splines.pdfRational Bezier Curves Rational Bezier curves in n of degree d: •Form a Bezier curve of

Related Problem

Approximation with rational curves:

• Scenario 1: Homogeneous data points given, with weights

Easy problem – linear system

• Scenario 2: Euclidian data points are given, but weights are fixed for each control point (e.g. manually)

Easy problem again – linear system

Weights just change the shape of the basis functions

• Scenario 3: Euclidian data points, want to compute weights as well

Non-linear optimization problem

Page 79: Geometric Modeling - Max Planck Societyresources.mpi-inf.mpg.de/.../12_Rational_Splines.pdfRational Bezier Curves Rational Bezier curves in n of degree d: •Form a Bezier curve of

General Rational Data Approximation

Scenerio 3: Euclidian data points, want to compute weights as well

• Non-linear optimization problem

• Issues:

No direct solution possible

Numerical optimization might get stuck in local minima

• Constraints:

We have to avoid poles

E.g. by demanding i > 0

Constrained optimization problem (even nastier)

Page 80: Geometric Modeling - Max Planck Societyresources.mpi-inf.mpg.de/.../12_Rational_Splines.pdfRational Bezier Curves Rational Bezier curves in n of degree d: •Form a Bezier curve of

General Rational Data Approximation

Simple idea for a numerical approach:

• First solve non-rational problem (all weights = 1)

• Then start constrained non-linear gradient descend (or Newton) solver from there