introduction - kth · 2015-11-05 · introduction to visualization and computer graphics, tino...

83
Introduction to Visualization and Computer Graphics DH2320, Fall 2015 Prof. Dr. Tino Weinkauf Geometric Modeling Introduction

Upload: others

Post on 28-Mar-2020

8 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: Introduction - KTH · 2015-11-05 · Introduction to Visualization and Computer Graphics, Tino Weinkauf, KTH Stockholm, Fall 2015 Geometric Modeling: Introduction Surface Models Defines

Introduction to Visualization and Computer Graphics

DH2320, Fall 2015

Prof. Dr. Tino Weinkauf

Geometric Modeling

Introduction

Page 2: Introduction - KTH · 2015-11-05 · Introduction to Visualization and Computer Graphics, Tino Weinkauf, KTH Stockholm, Fall 2015 Geometric Modeling: Introduction Surface Models Defines

Introduction to Visualization and Computer Graphics, Tino Weinkauf, KTH Stockholm, Fall 2015

Geometric Modeling: Introduction

● There are many ways for creating graphical data.

● Classic way: Geometric Modeling

p0

p1

p2

p3

Page 3: Introduction - KTH · 2015-11-05 · Introduction to Visualization and Computer Graphics, Tino Weinkauf, KTH Stockholm, Fall 2015 Geometric Modeling: Introduction Surface Models Defines

Introduction to Visualization and Computer Graphics, Tino Weinkauf, KTH Stockholm, Fall 2015

Geometric Modeling: Introduction

● There are many ways for

creating graphical data.

● Other approaches:

● 3D scanners

● Photography for measuring

optical properties

● Simulations, e.g., for flow

data 3D Scanning

Page 4: Introduction - KTH · 2015-11-05 · Introduction to Visualization and Computer Graphics, Tino Weinkauf, KTH Stockholm, Fall 2015 Geometric Modeling: Introduction Surface Models Defines

Introduction to Visualization and Computer Graphics, Tino Weinkauf, KTH Stockholm, Fall 2015

Geometric Modeling: Introduction

● Geometric objects convey a part of the real or theoretical

world; often, something tangible

● They are described by their geometric and topological

properties:

● Geometry describes the form and the position/orientation in a

coordinate system.

● Topology defines the fundamental structure that is invariant against

continuous transformations.

Different geometry

Same topology

Different geometry

Different topology

Page 5: Introduction - KTH · 2015-11-05 · Introduction to Visualization and Computer Graphics, Tino Weinkauf, KTH Stockholm, Fall 2015 Geometric Modeling: Introduction Surface Models Defines

Introduction to Visualization and Computer Graphics, Tino Weinkauf, KTH Stockholm, Fall 2015

Geometric Modeling: Introduction

● Geometric Modeling is the computer-aided design and

manipulation of geometric objects. (CAD)

● It is the basis for:

● computation of geometric properties

● rendering of geometric objects

● physics computations (if some physical attributes are given)

Page 6: Introduction - KTH · 2015-11-05 · Introduction to Visualization and Computer Graphics, Tino Weinkauf, KTH Stockholm, Fall 2015 Geometric Modeling: Introduction Surface Models Defines

Introduction to Visualization and Computer Graphics, Tino Weinkauf, KTH Stockholm, Fall 2015

Geometric Modeling: Introduction

● 3D models are geometric representations of 3D objects with

a certain level of abstraction.

● We distinguish between three types of models:

● Wire Frame Models

● describe an object using boundary lines

● Surface Models

● describe an object using boundary surfaces

● Solid Models

● describe an object as a solid

Page 7: Introduction - KTH · 2015-11-05 · Introduction to Visualization and Computer Graphics, Tino Weinkauf, KTH Stockholm, Fall 2015 Geometric Modeling: Introduction Surface Models Defines

Introduction to Visualization and Computer Graphics, Tino Weinkauf, KTH Stockholm, Fall 2015

Geometric Modeling: Introduction

Wire Frame Models

● Describe an object using boundary

curves

● No relationship between these

curves

● Surfaces between them are not

defined

● Properties:

● simple, traditional

● non-sense objects possible

● visibility of curves cannot be decided

● solid object intersection cannot be

computed

● surfaces between the curves cannot

be computed automatically

● not useable for CAD/CAM

non-sense objects (Ernst, 1987)

ambiguity of wire frame models

Page 8: Introduction - KTH · 2015-11-05 · Introduction to Visualization and Computer Graphics, Tino Weinkauf, KTH Stockholm, Fall 2015 Geometric Modeling: Introduction Surface Models Defines

Introduction to Visualization and Computer Graphics, Tino Weinkauf, KTH Stockholm, Fall 2015

Geometric Modeling: Introduction

Surface Models

● Defines surfaces between boundary

curves

● Describes the hull, but not the

interior of an object

● Often implemented using polygons,

hull of a sphere or ellipsoid, free-

form surfaces, …

● No relationship between the

surfaces

● The interior between them is not

defined

● Visibility computations: yes

Solid intersection comp.: no

● Most often used type of model

polygonal surface

representation

parametric surface

representation

using 32 Bezier

patches

Page 9: Introduction - KTH · 2015-11-05 · Introduction to Visualization and Computer Graphics, Tino Weinkauf, KTH Stockholm, Fall 2015 Geometric Modeling: Introduction Surface Models Defines

Introduction to Visualization and Computer Graphics, Tino Weinkauf, KTH Stockholm, Fall 2015

Geometric Modeling: Introduction

Solid Models

● Describe the 3D object

completely by covering the solid

● For every point in 3D, we can

decide whether it is inside or

outside of the solid.

● Visibility and intersection

computations are fully supported

● Basis for creating solid objects

using computer-aided

manufacturing

solid model and a cut through it

(Werkbild Strässle, from Ockert, 1993)

visibility computation for lines using a solid model

Page 10: Introduction - KTH · 2015-11-05 · Introduction to Visualization and Computer Graphics, Tino Weinkauf, KTH Stockholm, Fall 2015 Geometric Modeling: Introduction Surface Models Defines

Introduction to Visualization and Computer Graphics, Tino Weinkauf, KTH Stockholm, Fall 2015

Geometric Modeling: Introduction

Chrome-cobalt disc with crowns for dental implants, manufactured using WorkNC CAM

Sescoi CAD/CAM http://www.flickr.com/photos/cadcamzone/4679188766/. Licensed under CC BY-SA 2.0 via Commons -

https://commons.wikimedia.org/wiki/File:Disc_with_dental_implants_made_with_WorkNC.jpg#/media/File:Disc_with_dental_implants_made_with_WorkNC.jpg

Page 11: Introduction - KTH · 2015-11-05 · Introduction to Visualization and Computer Graphics, Tino Weinkauf, KTH Stockholm, Fall 2015 Geometric Modeling: Introduction Surface Models Defines

Introduction to Visualization and Computer Graphics

DH2320, Fall 2015

Prof. Dr. Tino Weinkauf

Geometric Modeling

Bezier Curves, Splines and Surfaces

de Casteljau Algorithm

Bernstein Form

Bezier Splines

Tensor Product Surfaces

Total Degree Surfaces

Page 12: Introduction - KTH · 2015-11-05 · Introduction to Visualization and Computer Graphics, Tino Weinkauf, KTH Stockholm, Fall 2015 Geometric Modeling: Introduction Surface Models Defines

Bezier Curves de Casteljau algorithm

• Paul de Casteljau (1959) @ Citroën • Pierre Bezier (1963) @ Renault

Meine Zeit bei Citroën / My time at Citroën see the PDF deCasteljau_de.pdf and deCasteljau_en.pdf in the download area of the webpage

Page 13: Introduction - KTH · 2015-11-05 · Introduction to Visualization and Computer Graphics, Tino Weinkauf, KTH Stockholm, Fall 2015 Geometric Modeling: Introduction Surface Models Defines

Bezier curves

History:

• Bezier curves/splines developed by

Paul de Casteljau at Citroën (1959)

Pierre Bézier at Renault (1963)

for free-form parts in automotive design

• Today: Standard tool for 2D curve editing

• Cubic 2D Bezier curves are everywhere:

Postscript, PDF, Truetype (quadratic curves), Windows GDI...

Inkscape, Corel Draw, Adobe Illustrator, Powerpoint, ...

• Widely used in 3D curve & surface modeling as well

Page 14: Introduction - KTH · 2015-11-05 · Introduction to Visualization and Computer Graphics, Tino Weinkauf, KTH Stockholm, Fall 2015 Geometric Modeling: Introduction Surface Models Defines

All You See is Bezier Curves...

Page 15: Introduction - KTH · 2015-11-05 · Introduction to Visualization and Computer Graphics, Tino Weinkauf, KTH Stockholm, Fall 2015 Geometric Modeling: Introduction Surface Models Defines

De Casteljau algorithm

Approximation setting:

Given: p0, …, pn

Wanted: smooth, approximating curve

Page 16: Introduction - KTH · 2015-11-05 · Introduction to Visualization and Computer Graphics, Tino Weinkauf, KTH Stockholm, Fall 2015 Geometric Modeling: Introduction Surface Models Defines

De Casteljau algorithm

Linear interpolation

Page 17: Introduction - KTH · 2015-11-05 · Introduction to Visualization and Computer Graphics, Tino Weinkauf, KTH Stockholm, Fall 2015 Geometric Modeling: Introduction Surface Models Defines

De Casteljau algorithm

Parabolas

planar curve, even if defined in R3

Example:

Page 18: Introduction - KTH · 2015-11-05 · Introduction to Visualization and Computer Graphics, Tino Weinkauf, KTH Stockholm, Fall 2015 Geometric Modeling: Introduction Surface Models Defines

De Casteljau algorithm

Another parabola construction

given: 3 points b0, b1, b2

parabola x(t)

Page 19: Introduction - KTH · 2015-11-05 · Introduction to Visualization and Computer Graphics, Tino Weinkauf, KTH Stockholm, Fall 2015 Geometric Modeling: Introduction Surface Models Defines

De Casteljau algorithm

Example

Page 20: Introduction - KTH · 2015-11-05 · Introduction to Visualization and Computer Graphics, Tino Weinkauf, KTH Stockholm, Fall 2015 Geometric Modeling: Introduction Surface Models Defines

De Casteljau algorithm

De Casteljau Algorithm: Computes x (t) for given t

• Bisect control polygon in ratio t : (1 – t)

• Connect the new dots with lines (adjacent segments)

• Interpolate again with the same ratio

• Iterate, until only one point is left

Page 21: Introduction - KTH · 2015-11-05 · Introduction to Visualization and Computer Graphics, Tino Weinkauf, KTH Stockholm, Fall 2015 Geometric Modeling: Introduction Surface Models Defines

De Casteljau algorithm

Description of the de Casteljau algorithm

• given: points

• wanted: curve

• geometric construction of the point x(t) for given t:

• Then, is the searched curve point x(t) at the parameter value t

Page 22: Introduction - KTH · 2015-11-05 · Introduction to Visualization and Computer Graphics, Tino Weinkauf, KTH Stockholm, Fall 2015 Geometric Modeling: Introduction Surface Models Defines

De Casteljau algorithm

bi(r) = (1-t)·bi

(r-1) + t·bi+1(r-1)

b0(0)

b1(0)

b2(0)

b3(0)

repeated convex combination of control points

b0(0)

b1(0)

b2(0)

b3(0)

Page 23: Introduction - KTH · 2015-11-05 · Introduction to Visualization and Computer Graphics, Tino Weinkauf, KTH Stockholm, Fall 2015 Geometric Modeling: Introduction Surface Models Defines

De Casteljau algorithm

bi(r) = (1-t)·bi

(r-1) + t·bi+1(r-1)

b0(0)

b1(0)

b2(0)

b3(0)

b0(1)

b1(1)

b2(1)

repeated convex combination of control points

b0(0)

b1(0)

b2(0)

b3(0)

b0(1)

b1(1)

b2(1)

1-t

1-t

1-t

t

t

t

Page 24: Introduction - KTH · 2015-11-05 · Introduction to Visualization and Computer Graphics, Tino Weinkauf, KTH Stockholm, Fall 2015 Geometric Modeling: Introduction Surface Models Defines

De Casteljau algorithm

bi(r) = (1-t)·bi

(r-1) + t·bi+1(r-1)

b0(0)

b1(0)

b2(0)

b3(0)

b0(1)

b1(1)

b2(1)

b0(2)

b1(2)

repeated convex combination of control points

b0(0)

b1(0)

b2(0)

b3(0)

b0(1)

b1(1)

b2(1)

1-t

1-t

1-t

t

t

t

b0(2)

b1(2)

1-t

t

1-t

t

Page 25: Introduction - KTH · 2015-11-05 · Introduction to Visualization and Computer Graphics, Tino Weinkauf, KTH Stockholm, Fall 2015 Geometric Modeling: Introduction Surface Models Defines

De Casteljau algorithm

bi(r) = (1-t)·bi

(r-1) + t·bi+1(r-1)

b0(0)

b1(0)

b2(0)

b3(0)

b0(1)

b1(1)

b2(1)

b0(2)

b1(2)

b0(3) = x(t)

repeated convex combination of control points

b0(0)

b1(0)

b2(0)

b3(0)

b0(1)

b1(1)

b2(1)

1-t

1-t

1-t

t

t

t

b0(2)

b1(2)

1-t

t

1-t

t b0(3) = x(t)

1-t

t

de Casteljau scheme

Page 26: Introduction - KTH · 2015-11-05 · Introduction to Visualization and Computer Graphics, Tino Weinkauf, KTH Stockholm, Fall 2015 Geometric Modeling: Introduction Surface Models Defines

De Casteljau algorithm

The intermediate coefficients bir(t) can be written in

a triangular matrix: the de Casteljau scheme:

Page 27: Introduction - KTH · 2015-11-05 · Introduction to Visualization and Computer Graphics, Tino Weinkauf, KTH Stockholm, Fall 2015 Geometric Modeling: Introduction Surface Models Defines

De Casteljau algorithm

Algorithm: for r = 1..n do

for i = 0..n-r do

bi(r) = (1-t)·bi

(r-1) + t·bi+1(r-1)

end for

end for

return b0(n)

b0(0)

b1(0)

b2(0)

b3(0)

b0(1)

b1(1)

b2(1)

b0(2)

b1(2)

b0(3) = x(t)

The whole algorithm consists only of repeated linear interpolations.

Page 28: Introduction - KTH · 2015-11-05 · Introduction to Visualization and Computer Graphics, Tino Weinkauf, KTH Stockholm, Fall 2015 Geometric Modeling: Introduction Surface Models Defines

De Casteljau algorithm

The polygon consisting of the points b0, …, bn is called Bezier polygon. The points bi are called Bezier points.

The curve defined by the Bezier points b0, …, bn and the de Casteljau algorithm is called Bezier curve.

The de Casteljau algorithm is numerically stable, since only convex combinations are applied.

Complexity of the de Casteljau algorithm • O(n2) time

• O(n) memory

• with n being the number of Bezier points

Page 29: Introduction - KTH · 2015-11-05 · Introduction to Visualization and Computer Graphics, Tino Weinkauf, KTH Stockholm, Fall 2015 Geometric Modeling: Introduction Surface Models Defines

De Casteljau algorithm

Properties of Bezier curves:

• given: Bezier points b0, …, bn

Bezier curve x(t)

• Bezier curve is polynomial curve of degree n.

• End point interpolation: x(0) = b0, x(1) = bn. The remaining Bezier points are only generally approximated.

• Convex hull property:

Bezier curve is completely inside the convex hull of its Bezier polygon.

Page 30: Introduction - KTH · 2015-11-05 · Introduction to Visualization and Computer Graphics, Tino Weinkauf, KTH Stockholm, Fall 2015 Geometric Modeling: Introduction Surface Models Defines

De Casteljau algorithm

• Variation diminishing no line intersects the Bezier curve more often than its Bezier polygon.

• Influence of Bezier points: global, but pseudo-local

• global: moving a Bezier point changes the whole curve progression

• pseudo-local: bi has its maximal influence on x(t) at t = i /n.

• Affine invariance: Bezier curve and Bezier polygon are invariant under affine transformations

• Invariance under affine parameter transformations

Page 31: Introduction - KTH · 2015-11-05 · Introduction to Visualization and Computer Graphics, Tino Weinkauf, KTH Stockholm, Fall 2015 Geometric Modeling: Introduction Surface Models Defines

De Casteljau algorithm

• Symmetry: The following two Bezier curves coincide, they are only traversed in opposite directions:

• Linear precision: Bezier curve is line segment, if b0,…, bn are collinear

• Invariant under barycentric combinations

Page 32: Introduction - KTH · 2015-11-05 · Introduction to Visualization and Computer Graphics, Tino Weinkauf, KTH Stockholm, Fall 2015 Geometric Modeling: Introduction Surface Models Defines

1-t

t

De Casteljau algorithm

• First derivative of a Bezier curve

• Endpoints:

b0(0)

b1(0)

b2(0)

b3(0)

b0(1)

b1(1)

b2(1)

b0(2)

b1(2)

b0(3) = x(t)

de Casteljau scheme

𝐱 𝑡 = 𝑛 𝐛1𝑛−1

− 𝐛0𝑛−1

-1

1

b0(0)

b1(0)

b2(0)

b3(0)

b0(1)

b1(1)

b2(1)

1-t

1-t

1-t

t

t

t

b0(2)

b1(2)

1-t

t

1-t

t

Page 33: Introduction - KTH · 2015-11-05 · Introduction to Visualization and Computer Graphics, Tino Weinkauf, KTH Stockholm, Fall 2015 Geometric Modeling: Introduction Surface Models Defines

-1

1

De Casteljau algorithm

• Second derivative of a Bezier curve

b0(0)

b1(0)

b2(0)

b3(0)

b0(1)

b1(1)

b2(1)

b0(2)

b1(2)

b0(3) = x(t)

de Casteljau scheme

b0(0)

b1(0)

b2(0)

b3(0)

b0(1)

b1(1)

b2(1)

1-t

1-t

1-t

t

t

t

b0(2)

b1(2)

-1

1

-1

1 𝐱 𝑡 = 𝑛 𝑛 − 1 𝐛2𝑛−2

− 2𝐛1𝑛−2

+ 𝐛0𝑛−2

Page 34: Introduction - KTH · 2015-11-05 · Introduction to Visualization and Computer Graphics, Tino Weinkauf, KTH Stockholm, Fall 2015 Geometric Modeling: Introduction Surface Models Defines

Bezier Curves Bernstein form

Page 35: Introduction - KTH · 2015-11-05 · Introduction to Visualization and Computer Graphics, Tino Weinkauf, KTH Stockholm, Fall 2015 Geometric Modeling: Introduction Surface Models Defines

Bernstein Basis

Bezier curves are algebraically defined using the Bernstein basis:

• Bernstein basis of degree n:

)()(1

)(0 ,...,, n

nnn BBBB

inini tt

i

ntB

1:)()(

n = 10 n = 2 (quad.)

B0

B1

B2

n = 3 (cubic)

B0

B1 B2

B3

Page 36: Introduction - KTH · 2015-11-05 · Introduction to Visualization and Computer Graphics, Tino Weinkauf, KTH Stockholm, Fall 2015 Geometric Modeling: Introduction Surface Models Defines

Bernstein Basis

de Casteljau algorithm

curve basis function control point

Bernstein form 𝑓 𝑡 = 𝐵𝑖

𝑛𝑡 𝐩i

𝑛

𝑖=0

Page 37: Introduction - KTH · 2015-11-05 · Introduction to Visualization and Computer Graphics, Tino Weinkauf, KTH Stockholm, Fall 2015 Geometric Modeling: Introduction Surface Models Defines

Examples

The first three Bernstein bases:

3)3(3

2)3(2

2)3(1

3)3(0

2)2(2

)2(1

2)2(0

)1(1

)1(0

)0(0

:13:

13:1:

:12:1:

:1:

1:

tBttB

ttBtB

tBttBtB

tBtB

B

n = 3 (cubic)

B0

B1 B2

B3

n = 1 (linear)

B0 B1

n = 2 (quad.)

B0

B1

B2

inini tt

i

ntB

1:)()(

Page 38: Introduction - KTH · 2015-11-05 · Introduction to Visualization and Computer Graphics, Tino Weinkauf, KTH Stockholm, Fall 2015 Geometric Modeling: Introduction Surface Models Defines

Bezier Curves in Bernstein form

Bezier Curves:

n

i

niiBt

0

)()( pf

p0

p1

p2

p3

p0

p1

p2

p3

n = 3 (cubic)

B0

B1 B2

B3

p0

p1

p2

p3

p0

p1 p2

p3

t [0..1]

Page 39: Introduction - KTH · 2015-11-05 · Introduction to Visualization and Computer Graphics, Tino Weinkauf, KTH Stockholm, Fall 2015 Geometric Modeling: Introduction Surface Models Defines

Summary for Bezier Curves

Bezier curves and curve design: • The rough form is specified by the position of the control

points

• Result: smooth curve approximating the control points

• Computation / Representation: de Casteljau algorithm

Bernstein form

• Problems: high polynomial degree

moving a control point can change the whole curve

interpolation of points

Bezier splines

Page 40: Introduction - KTH · 2015-11-05 · Introduction to Visualization and Computer Graphics, Tino Weinkauf, KTH Stockholm, Fall 2015 Geometric Modeling: Introduction Surface Models Defines

Towards Bezier Splines

Approximation Interpolation

Page 41: Introduction - KTH · 2015-11-05 · Introduction to Visualization and Computer Graphics, Tino Weinkauf, KTH Stockholm, Fall 2015 Geometric Modeling: Introduction Surface Models Defines

Towards Bezier Splines

Interpolation problem:

• given:

control points

knot sequence

• wanted:

interpolating curve x(t), i.e., x(ti) = ki for i = 0, …, n

• Approach: "Joining" of n Bezier curves with certain intersection conditions

Page 42: Introduction - KTH · 2015-11-05 · Introduction to Visualization and Computer Graphics, Tino Weinkauf, KTH Stockholm, Fall 2015 Geometric Modeling: Introduction Surface Models Defines

Towards Bezier Splines

The following issues arise when stitching together Bezier curves:

• Continuity

• Degree

• (Parameterization)

Page 43: Introduction - KTH · 2015-11-05 · Introduction to Visualization and Computer Graphics, Tino Weinkauf, KTH Stockholm, Fall 2015 Geometric Modeling: Introduction Surface Models Defines

Bezier Splines Parametric and Geometric Continuity

Page 44: Introduction - KTH · 2015-11-05 · Introduction to Visualization and Computer Graphics, Tino Weinkauf, KTH Stockholm, Fall 2015 Geometric Modeling: Introduction Surface Models Defines

Continuity

Joining of curves - continuity

• given: 2 curves

x1(t) over [t0, t1]

x2(t) over [t1, t2]

• x1 and x2 are Cr continuous in t1, if they coincide in

0th – rth derivative vector in t1.

Page 45: Introduction - KTH · 2015-11-05 · Introduction to Visualization and Computer Graphics, Tino Weinkauf, KTH Stockholm, Fall 2015 Geometric Modeling: Introduction Surface Models Defines

Continuity

C-1 continuity C0 continuity

C1 continuity C2 continuity

Page 46: Introduction - KTH · 2015-11-05 · Introduction to Visualization and Computer Graphics, Tino Weinkauf, KTH Stockholm, Fall 2015 Geometric Modeling: Introduction Surface Models Defines

Continuity

Parametric Continuity Cr:

• C0, C1, C2... continuity.

• Does a particle moving on this curve have a smooth trajectory (position, velocity, acceleration,...)?

• Useful for animation (object movement, camera paths)

• Depends on parameterization

Geometric Continuity Gr:

• Independent of parameterization

• Is the curve itself smooth?

• More relevant for modeling (curve design)

Page 47: Introduction - KTH · 2015-11-05 · Introduction to Visualization and Computer Graphics, Tino Weinkauf, KTH Stockholm, Fall 2015 Geometric Modeling: Introduction Surface Models Defines

Bezier Splines

Local control: Bezier splines

• Concatenate several curve segments

• Question: Which constraints to place upon the control points in order to get C-1, C0, C1, C2 continuity?

p0

p1

p2

p3

p0

p1

p2

p3

(i)

(i)

(i)

(i)

(i+1)

(i+1)

(i+1)

(i+1)

Page 48: Introduction - KTH · 2015-11-05 · Introduction to Visualization and Computer Graphics, Tino Weinkauf, KTH Stockholm, Fall 2015 Geometric Modeling: Introduction Surface Models Defines

Bezier Spline Continuity

Rules for Bezier spline continuity:

• C0 continuity:

Each spline segment interpolates the first and last control point

Therefore: Points of neighboring segments have to coincide for C0 continuity.

p1 (i)

(i) p0

(i) p2

p3 (i)

p0 (i+1)

p1 (i+1)

p2 (i+1)

p3 (i+1)

Page 49: Introduction - KTH · 2015-11-05 · Introduction to Visualization and Computer Graphics, Tino Weinkauf, KTH Stockholm, Fall 2015 Geometric Modeling: Introduction Surface Models Defines

Bezier Spline Continuity

Rules for Bezier spline continuity:

• Additional requirement for C1 continuity:

Tangent vectors are proportional to differences p1 – p0, pn – pn-1

Therefore: These vectors must be identical for C1 continuity

p1 (i)

(i) p0

(i) p2

p3 (i)

p0 (i+1)

p1 (i+1)

p2 (i+1)

p3 (i+1)

Page 50: Introduction - KTH · 2015-11-05 · Introduction to Visualization and Computer Graphics, Tino Weinkauf, KTH Stockholm, Fall 2015 Geometric Modeling: Introduction Surface Models Defines

Bezier Spline Continuity

Rules for Bezier spline continuity:

• Additional requirement for C2 continuity:

𝐝− = 𝐝+

Page 51: Introduction - KTH · 2015-11-05 · Introduction to Visualization and Computer Graphics, Tino Weinkauf, KTH Stockholm, Fall 2015 Geometric Modeling: Introduction Surface Models Defines

Continuity

C-1 continuity C0 continuity

G1 continuity C1 continuity

Page 52: Introduction - KTH · 2015-11-05 · Introduction to Visualization and Computer Graphics, Tino Weinkauf, KTH Stockholm, Fall 2015 Geometric Modeling: Introduction Surface Models Defines

Bezier Splines Choosing the degree

Page 53: Introduction - KTH · 2015-11-05 · Introduction to Visualization and Computer Graphics, Tino Weinkauf, KTH Stockholm, Fall 2015 Geometric Modeling: Introduction Surface Models Defines

Choosing the Degree...

Candidates:

• d = 0 (piecewise constant): not smooth

• d = 1 (piecewise linear): not smooth enough

• d = 2 (piecewise quadratic): constant 2nd derivative, still too inflexible

• d = 3 (piecewise cubic): degree of choice for computer graphics applications

Page 54: Introduction - KTH · 2015-11-05 · Introduction to Visualization and Computer Graphics, Tino Weinkauf, KTH Stockholm, Fall 2015 Geometric Modeling: Introduction Surface Models Defines

Cubic Splines

Cubic piecewise polynomials:

• We can attain C2 continuity without fixing the second derivative throughout the curve

• C2 continuity is perceptually important We can see second order shading discontinuities

(esp.: reflective objects)

Motion: continuous position, velocity & acceleration Discontinuous acceleration noticeable (object/camera motion)

• One more argument for cubics: Among all C2 curves that interpolate a set of points (and obey to

the same end conditions), a piecewise cubic curve has the least integral acceleration (“smoothest curve you can get”).

– see AdditionalMaterial/CubicsMinimizeAcceleration.pdf

Page 55: Introduction - KTH · 2015-11-05 · Introduction to Visualization and Computer Graphics, Tino Weinkauf, KTH Stockholm, Fall 2015 Geometric Modeling: Introduction Surface Models Defines

Spline Surfaces

Page 56: Introduction - KTH · 2015-11-05 · Introduction to Visualization and Computer Graphics, Tino Weinkauf, KTH Stockholm, Fall 2015 Geometric Modeling: Introduction Surface Models Defines

Spline Surfaces

Two different approaches

• Tensor product surfaces

Simple construction

Everything carries over from curve case

Quad patches

Degree anisotropy

• Total degree surfaces

Not as straightforward

Isotropic degree

Triangle patches

“Natural” generalization of curves

Page 57: Introduction - KTH · 2015-11-05 · Introduction to Visualization and Computer Graphics, Tino Weinkauf, KTH Stockholm, Fall 2015 Geometric Modeling: Introduction Surface Models Defines

Tensor Product Surfaces

Page 58: Introduction - KTH · 2015-11-05 · Introduction to Visualization and Computer Graphics, Tino Weinkauf, KTH Stockholm, Fall 2015 Geometric Modeling: Introduction Surface Models Defines

Tensor Product Bezier Surfaces

Bezier curves: repeated linear interpolation

bilinear interpolation: repeated linear interpolation

repeated bilinear interpolation: gives us tensor product Bezier surfaces (example shows quadratic Bezier surface)

now a different setup: 4 points b00, b10, b11, b01

parameter area [0,1] [0,1]

b00

b01

b10

b11

x(u,v)

Page 59: Introduction - KTH · 2015-11-05 · Introduction to Visualization and Computer Graphics, Tino Weinkauf, KTH Stockholm, Fall 2015 Geometric Modeling: Introduction Surface Models Defines

De Casteljau Algorithm

De Casteljau algorithm for tensor product surfaces:

v

u b(0,0,0; 0,0,0)

b(1,1,1; 0,0,0)

b(0,0,0; 1,1,1)

b(1,1,1; 1,1,1)

b(u,u,u; v,v,v)

b(u,0,0; v,0,0)

b(u,0,0; v,1,1)

b(u,1,1; v,0,0)

b(u,1,1; v,1,1)

b(u,u,0; v,v,1)

b(u,u,0; v,v,0)

b(u,u,1; v,v,1)

b(u,u,1; v,v,0)

Page 60: Introduction - KTH · 2015-11-05 · Introduction to Visualization and Computer Graphics, Tino Weinkauf, KTH Stockholm, Fall 2015 Geometric Modeling: Introduction Surface Models Defines

Tensor Product Surfaces

Tensor Product Surfaces:

• “Curves of Curves”

• Order does not matter

n

j

n

ijiij

n

i

n

jjiji

n

i

n

jjiji

vbub

vbub

vbubvu

1 1,

1 1,

1 1,

)()(

)()(

)()(),(

p

p

pf

Page 61: Introduction - KTH · 2015-11-05 · Introduction to Visualization and Computer Graphics, Tino Weinkauf, KTH Stockholm, Fall 2015 Geometric Modeling: Introduction Surface Models Defines

Tensor Product Surfaces Bezier Patches

Page 62: Introduction - KTH · 2015-11-05 · Introduction to Visualization and Computer Graphics, Tino Weinkauf, KTH Stockholm, Fall 2015 Geometric Modeling: Introduction Surface Models Defines

Bezier Patches

Bezier Patches:

• Remember endpoint interpolation:

Boundary curves are Bezier curves of the boundary control points

d = 10 d = 3

B0

B1 B2

B3

Page 63: Introduction - KTH · 2015-11-05 · Introduction to Visualization and Computer Graphics, Tino Weinkauf, KTH Stockholm, Fall 2015 Geometric Modeling: Introduction Surface Models Defines

Continuity Conditions

For C0 continuity:

• Boundary control points must match

For C1 continuity:

• Difference vectors must match at the boundary

Page 64: Introduction - KTH · 2015-11-05 · Introduction to Visualization and Computer Graphics, Tino Weinkauf, KTH Stockholm, Fall 2015 Geometric Modeling: Introduction Surface Models Defines

C0 Continuity

Page 65: Introduction - KTH · 2015-11-05 · Introduction to Visualization and Computer Graphics, Tino Weinkauf, KTH Stockholm, Fall 2015 Geometric Modeling: Introduction Surface Models Defines

C1 Continuity

Page 66: Introduction - KTH · 2015-11-05 · Introduction to Visualization and Computer Graphics, Tino Weinkauf, KTH Stockholm, Fall 2015 Geometric Modeling: Introduction Surface Models Defines

C1 Continuity

Page 67: Introduction - KTH · 2015-11-05 · Introduction to Visualization and Computer Graphics, Tino Weinkauf, KTH Stockholm, Fall 2015 Geometric Modeling: Introduction Surface Models Defines

Total Degree Surfaces

Page 68: Introduction - KTH · 2015-11-05 · Introduction to Visualization and Computer Graphics, Tino Weinkauf, KTH Stockholm, Fall 2015 Geometric Modeling: Introduction Surface Models Defines

Spline Surfaces

Two different approaches

• Tensor product surfaces

Simple construction

Everything carries over from curve case

Quad patches

Degree anisotropy

• Total degree surfaces

Not as straightforward

Isotropic degree

Triangle patches

“Natural” generalization of curves

Page 69: Introduction - KTH · 2015-11-05 · Introduction to Visualization and Computer Graphics, Tino Weinkauf, KTH Stockholm, Fall 2015 Geometric Modeling: Introduction Surface Models Defines

Bezier Triangles

Alternative surface definition: Bezier triangles

• Constructed according to given total degree

Completely symmetric: No degree anisotropy

• Can be derived using a triangular de Casteljau algorithm

Barycentric interpolation

Page 70: Introduction - KTH · 2015-11-05 · Introduction to Visualization and Computer Graphics, Tino Weinkauf, KTH Stockholm, Fall 2015 Geometric Modeling: Introduction Surface Models Defines

Barycentric Coordinates

Barycentric Coordinates:

• Planar case: Barycentric combinations of 3 points

• Area formulation:

1:with,321 pppp

1

)),,((

)),,((,

)),,((

)),,((,

)),,((

)),,((

321

21

321

31

321

32

ppp

ppp

ppp

ppp

ppp

ppp

area

area

area

area

area

area

p1

p2

p3

p

Page 71: Introduction - KTH · 2015-11-05 · Introduction to Visualization and Computer Graphics, Tino Weinkauf, KTH Stockholm, Fall 2015 Geometric Modeling: Introduction Surface Models Defines

Example

Cubic Bezier Triangle: c

a b p(a,a,a) p(b,a,a) p(b,b,a) p(b,b,b)

p(c,a,a) p(c,b,b)

p(c,c,b)

p(c,c,c)

p(c,c,a)

p(a,b,c)

Page 72: Introduction - KTH · 2015-11-05 · Introduction to Visualization and Computer Graphics, Tino Weinkauf, KTH Stockholm, Fall 2015 Geometric Modeling: Introduction Surface Models Defines

De Casteljau Algorithm

p(a,b,c)

a

b

c

p(a,a,a) p(c,a,a)

p(c,c,a)

p(c,c,c)

p(c,c,b)

p(c,b,b)

p(b,a,a)

p(b,b,a) p(b,b,b)

p(x,b,c)

p(x,c,c)

p(x,a,a)

p(x,b,b) p(x,a,b)

p(x,a,c)

p(x,x,c)

p(x,x,a)

p(x,x,b)

p(x,x,x)

1

,

cbax

Page 73: Introduction - KTH · 2015-11-05 · Introduction to Visualization and Computer Graphics, Tino Weinkauf, KTH Stockholm, Fall 2015 Geometric Modeling: Introduction Surface Models Defines

Continuity

We need to assemble Bezier triangles continuously:

• What are the conditions for C0, C1 continuity?

• As an example, we will look at the quadratic case...

Page 74: Introduction - KTH · 2015-11-05 · Introduction to Visualization and Computer Graphics, Tino Weinkauf, KTH Stockholm, Fall 2015 Geometric Modeling: Introduction Surface Models Defines

Continuity

Situation:

• Two Bezier triangles meet along a common edge.

Parametrization: T1 = {a, b, c}, T2 = {c, b, d}

Polynomial surfaces F(T1), G(T2)

Control points:

– F(T1): f(a, a), f(a, b), f(b, b), f(a, c), f(c, c), f(b, c)

– G(T2): g(d, d), g(d, b), g(b, b), g(d, c), g(c, c), g(b, c)

b

c

d

a F

G

Page 75: Introduction - KTH · 2015-11-05 · Introduction to Visualization and Computer Graphics, Tino Weinkauf, KTH Stockholm, Fall 2015 Geometric Modeling: Introduction Surface Models Defines

Continuity

Situation: b

c

d

a F

G

f(a, a)

f(a, b)

f(b, b)

f(a, c) f(c, c)

f(b, c) g(d, d)

g(b, d)

g(b, b)

g(c, d)

g(c, c)

g(b, c)

Page 76: Introduction - KTH · 2015-11-05 · Introduction to Visualization and Computer Graphics, Tino Weinkauf, KTH Stockholm, Fall 2015 Geometric Modeling: Introduction Surface Models Defines

Continuity

C0 Continuity:

• The points on the boundary have to agree: f(b, b) = g(b, b) f(b, c) = g(b, c) f(c, c) = g(c, c)

• Proof: 1,: Let cbx

),(),(),(

),(),(2),(

),(

),(

),(

),(2

),(

),(

),(),(),(

22

||

2

||||

2

xxgxcgxbg

ccgcbgbbg

ccg

ccf

cbg

cbf

bbg

bbf

xcfxbfxxf

Page 77: Introduction - KTH · 2015-11-05 · Introduction to Visualization and Computer Graphics, Tino Weinkauf, KTH Stockholm, Fall 2015 Geometric Modeling: Introduction Surface Models Defines

Continuity

C1 Continuity:

• We need C0 continuity.

In addition:

• Points at hatched quadrilaterals are coplanar

• Hatched quadrilaterals are an affine image of the same parameter quadrilateral

Page 78: Introduction - KTH · 2015-11-05 · Introduction to Visualization and Computer Graphics, Tino Weinkauf, KTH Stockholm, Fall 2015 Geometric Modeling: Introduction Surface Models Defines

Curves on Surfaces, trimmed NURBS

Quad patch problem:

• All of our shapes are parameterized over rectangular or triangular regions

• General boundary curves are hard to create

• Topology fixed to a disc (or cylinder, torus)

• No holes in the middle

• Assembling complicated shapes is painful

Lots of pieces

Continuity conditions for assembling pieces become complicated

Cannot use C2 B-Splines continuity along boundaries when using multiple pieces

Page 79: Introduction - KTH · 2015-11-05 · Introduction to Visualization and Computer Graphics, Tino Weinkauf, KTH Stockholm, Fall 2015 Geometric Modeling: Introduction Surface Models Defines

Curves on Surfaces, trimmed NURBS

Consequence:

• We need more control over the parameter domain

• One solution is trimming using curves on surfaces (CONS)

• Standard tool in CAD: trimmed NURBS

Basic idea:

• Specify a curve in the parameter domain that encapsulates one (or more) pieces of area

• Tessellate the parameter domain accordingly to cut out the trimmed piece (rendering)

Page 80: Introduction - KTH · 2015-11-05 · Introduction to Visualization and Computer Graphics, Tino Weinkauf, KTH Stockholm, Fall 2015 Geometric Modeling: Introduction Surface Models Defines

Curves-on-Surfaces (CONS)

Page 81: Introduction - KTH · 2015-11-05 · Introduction to Visualization and Computer Graphics, Tino Weinkauf, KTH Stockholm, Fall 2015 Geometric Modeling: Introduction Surface Models Defines

Curves-on-Surfaces (CONS)

Page 82: Introduction - KTH · 2015-11-05 · Introduction to Visualization and Computer Graphics, Tino Weinkauf, KTH Stockholm, Fall 2015 Geometric Modeling: Introduction Surface Models Defines

Curves-on-Surfaces (CONS)

Page 83: Introduction - KTH · 2015-11-05 · Introduction to Visualization and Computer Graphics, Tino Weinkauf, KTH Stockholm, Fall 2015 Geometric Modeling: Introduction Surface Models Defines

Summary

• Bezier Curves

• de Casteljau algorithm

• Bernstein form

• Bezier Splines

• Bezier Tensor Product Surfaces

• Bezier Total Degree Surfaces