Parametric Curves and Surfaces Graphics & Visualization: - - PowerPoint PPT Presentation

parametric curves and surfaces
SMART_READER_LITE
LIVE PREVIEW

Parametric Curves and Surfaces Graphics & Visualization: - - PowerPoint PPT Presentation

Graphics & Visualization Chapter 7 Parametric Curves and Surfaces Graphics & Visualization: Principles & Algorithms Chapter 7 Introduction We have already presented algorithms for the rasterization


slide-1
SLIDE 1

Graphics & Visualization

Chapter 7

Parametric Curves and Surfaces

Graphics & Visualization: Principles & Algorithms Chapter 7

slide-2
SLIDE 2
  • We have already presented algorithms for the rasterization of

basic geometric primitives, lines and circles.

  • Realistic graphics scenes need more flexible, free-form curves &

surfaces.

  • CAGD (Computer-Aided Geometric Design): area of computer

graphics that deals with free-form shapes

  • 1960’s:

Introduction

Graphics & Visualization: Principles & Algorithms Chapter 7

  • 1960’s:

The need for mathematical representations of free-form shapes

became apparent in the automotive and aeronautic industries

Paul de Casteljau & Pierre Bézier developed independently the

theory of polynomial curves & surfaces

This theory constitutes the basic tool for describing and rendering

free-form shapes.

2

slide-3
SLIDE 3
  • All of the curve and surface descriptions are in parametric form:
  • Curves in parametric form:

Given as 2 (for plane curves) or 3 (for space curves) independent

coordinate functions in terms of a parameter t.

Introduction (2)

( ) ( ) ( )

  • r

( ) ( ) ( ) ( ) x t x t t t y t y t z t     = =                 X X

Graphics & Visualization: Principles & Algorithms Chapter 7

The description of plane and space curves is essentially the same,

z(t) = 0 for a plane curve

  • Surfaces in parametric form:

are given as 3 independent coordinate functions in terms of 2

parameters u and v:

( ) z t      

( , ) ( , ) ( , ) ( , ) x u v u v y u v z u v             = X

3

slide-4
SLIDE 4
  • Line segment in parametric form:

Between two points p0 and p1 P(t) = (1-t) p0 + t p1 , t

[0,1]

Expresses the linear interpolation between these points (p0 and p1)

Introduction (3)

Graphics & Visualization: Principles & Algorithms Chapter 7 4

slide-5
SLIDE 5

I. Quadratic Bézier Curves II. nth-Degree Bézier Curves

  • III. The de Casteljau Algorithm
  • IV. Bernstein Polynomials
  • V. Properties of Bézier Curves
  • VI. Bézier Curve Subdivision

Bézier Curves

Graphics & Visualization: Principles & Algorithms Chapter 7

  • VI. Bézier Curve Subdivision

VII.Smoothly Joining Bézier Curves

5

slide-6
SLIDE 6
  • Consider 3 points p0, p1 and p2
  • First step: interpolate them in pairs (p0, p1) and (p1, p2):
  • For each value t

[0,1], and represent points on the line segments p0p1 and p1p2 respectively.

I. Quadratic Bézier Curves

1 0( )

t p

1 1( )

t p

1 1 1 1 1 2

( ) (1 ) ( , (1 , ) ) t t t t t t = − + = − + p p p p p p

[0,1] t ∈

1

p

1

p

Graphics & Visualization: Principles & Algorithms Chapter 7

  • Second step: interpolate points and for the same t:

6

1 0( )

t p

1 1( )

t p

2 1 1 1 2 2 1 2

( ) (1 ) ( ) ( ) (1 ) 2 (1 ) t t t t t t t t t = − + = − + − + p p p p p p

1

p p

2

p

2 2 0( )

( ) t t

  • p

P

1 1( )

t p

1 0( )

t p

slide-7
SLIDE 7
  • As t increases from 0 to 1, the three points , ,

move concurrently on the respective line segments

  • Last equation shows that the point traces a quadratic

(second-degree) curve with respect to the parameter t.

  • This curve

is a quadratic Bézier curve (or a second-degree Bézier curve)

Will be denoted by P2(t)

I. Quadratic Bézier Curves (2)

1 0( )

t p

1 1( )

t p

2 0( )

t p

2 0( )

t p

Graphics & Visualization: Principles & Algorithms Chapter 7

Will be denoted by P2(t)

  • Control points of the Bézier curve: the initial points p0, p1, p2
  • : r : the interpolation step

i : the index of the first point being interpolated

7

( )

r i t

p

slide-8
SLIDE 8
  • The process for the generation of a quadratic Bézier curve can

be generalized for more control points.

  • Cubic (or three-degree) Bézier curve P3(t)

Needs four control points Performs three linear interpolation steps

II. nth-Degree Bézier Curves

1

p

1

p

1 1

p

2

p

1 2

p p

2

p

2 1

p

3 3

( ) t

  • p

P

Graphics & Visualization: Principles & Algorithms Chapter 7

  • General case: nth-degree Bézier curve Pn(t)

Need for (n+1) control points p0, p1, …, pn Perform n linear interpolation steps Control polygon of the curve: the polygon formed by p0,p1,…, pn The curve is given by:

(1)

8

p

3

p

( ) (1 ) , [0,1 ]

n n i n i i i

n t t t t i

− =

    =  − ∈       

P p

slide-9
SLIDE 9
  • Formula (1) is numerically complex & unstable (requires

computations of binomial coefficients & powers of t and (1-t) )

  • The interpolation steps performed for the generation of the

Bézier curve are simple linear relations of t.

  • The de Casteljau algorithm:

Computes the Bézier curve points

Summarizes the linear interpolation steps in an iterative scheme

  • III. The de Casteljau Algorithm

Graphics & Visualization: Principles & Algorithms Chapter 7

Summarizes the linear interpolation steps in an iterative scheme

  • Steps:

1. For the required value of t, set 2. Perform the linear interpolation steps: 3. The point on the curve corresponding to parametric value t is

9 0( )

, 0,1,...,

i i

t i n = = p p

( ) ( )

n n

t t = P p

1 1 1

( ) (1 ) ( ) ( ), 1,2,..., 0,1,...,

r r r i i i

t t t t t r n i n r p p p

− − +

= − + = = −

slide-10
SLIDE 10
  • The de Casteljau triangle: All the intermediate points involved in the de

Casteljau algorithm can be written in a triangular arrangement

  • For the case of a cubic Bézier curve, the triangle is
  • III. The de Casteljau Algorithm (2)

Graphics & Visualization: Principles & Algorithms Chapter 7

  • Implementation:

No need to store all intermediate points Use a one-dimensional array Initialize it with the control points of the curve Overwrite its elements from top to bottom as the algorithm progresses At the end, the point on the curve will be the first element of the array

10

slide-11
SLIDE 11

The de Casteljau Algorithm:

point bezierPoint ( int n, point[] controlPt, float t ) { point deCasPt[n+1]; for (i=0; i <= n; i++) deCasPt[i] = controlPt[i]; for (r=1; r <= n; r++) { for (i=0; i <= n-r; i++) {

  • III. The de Casteljau Algorithm (3)

Graphics & Visualization: Principles & Algorithms Chapter 7

for (i=0; i <= n-r; i++) { deCasPt[i] = (1-t)*deCasPt[i] + t*deCasPt[i+1]; } } return deCasPt[0]; }

11

slide-12
SLIDE 12

EXAMPLE 1: Bézier Curve Point Evaluation Given a Bézier curve with control points p0=[0 0]T , p1=[2 2]T , p2=[6 4]T and p3=[8 2]T compute the point corresponding to the parametric value t = ¼. SOLUTION

  • III. The de Casteljau Algorithm (4)

Graphics & Visualization: Principles & Algorithms Chapter 7

SOLUTION

  • The de Casteljau triangle is:
  • Each point is an affine combination
  • f two points from the column at its left

On the same line with coefficients ¾ On the next line with coefficient ¼

The required point is

12

( )

3 1 4

29 16 23 16                 = P

slide-13
SLIDE 13
  • The Bézier curve definition:
  • The coefficients of pi are special polynomials called nth-degree

Bernstein polynomials:

  • So the Bézier curve can be written:
  • IV. Bernstein Polynomials

( ) (1 ) , 0,1,2,...,

n i n i i

n B t t t i n i

    =  − =       

( ) (1 ) , [0,1]

n n i n i i i

n t t t t i

− =

    =  − ∈       

P p ( ) ( ) , [0,1]

n n n i i

t B t t = ∈

P p

Graphics & Visualization: Principles & Algorithms Chapter 7

  • For the most common cases n=2 and n=3, the Bernstein

polynomials are:

13

( ) ( ) , [0,1]

i i i

t B t t

=

= ∈

P p

2 2 3 3 2 3 2 1 1 2 2 3 2 2 2

( ) (1 ) ( ) (1 ) ( ) 2 (1 ) ( ) 3 (1 ) ( ) ( ) 3 (1 =2 =3 ) n B t t B t t B t t t B t t t B t t B t n t t = − = − = − = − = = −

3 3 3

) ( B t t =

slide-14
SLIDE 14
  • The nth-degree Bernstein polynomials constitute a basis of the

vector space of the nth-degree polynomials: any nth-degree polynomial f(t) can be written in the form: where ci , i=0,1,2,…,n are suitable (scalar) coefficients

  • IV. Bernstein Polynomials: properties

( ) ( )

n i n i i

f t t c B

=

=∑

n

Graphics & Visualization: Principles & Algorithms Chapter 7

  • Bernstein polynomials satisfy
  • Bernstein polynomials are symmetric with respect to t and 1 – t :

14

( ) 1 , and ( ) 1 , [0,1]

n n i i n i

B t t B t t

=

= ∀ ≤ ≤ ∈

( ) (1 )

n n j n j

B t B t

= −

slide-15
SLIDE 15
  • Every nth-degree polynomial curve may be written in the form of a

Bézier curve.

  • Convex-hull property

The Bézier curve always lies inside the convex hull of its control points

  • Invariance under affine transformations

The Bézier curve is an affine combination of its control points Therefore, to apply an affine transformation to a Bézier curve, just transform

  • V. Properties of Bézier Curves

Graphics & Visualization: Principles & Algorithms Chapter 7

Therefore, to apply an affine transformation to a Bézier curve, just transform

its control points

  • Invariance under affine transformations of its parameter

The curve remains unaltered if t [0, 1] is changed to u

[a, b] where u = a + (b-a) t

The interpolation steps become

15

∈ ∈

1 1 1

( ) ( ) ( )

r r r i i i

b u u a t t t b a b a

− − +

− − = + − − p p p

slide-16
SLIDE 16
  • Symmetry with respect to its control points

If the control points are used in reverse order pn,pn-1,…,p1,p0 the shape of the

curve does not change

The curve is traversed in the opposite direction

  • Linear precision

If all control points lie on a straight line, then the curve also has the shape of

a straight line

  • V. Properties of Bézier Curves (2)

Graphics & Visualization: Principles & Algorithms Chapter 7

  • Variation-diminishing property

A planar Bézier curve is intersected by an arbitrary straight line no more than

the number of times that the line intersects the control polygon of the curve.

A non-planar Bézier curve is intersected by an arbitrary line or plane no more

than the number of times that the line or plane intersects the control polygon

  • f the curve.

A curve with a convex control polygon is also convex but the inverse is not

always true (a convex Bézier curve may have a non-convex control polygon)

16

slide-17
SLIDE 17
  • Endpoint interpolation

The curve starts at its first control point and ends at its last one

Pn (0) = p0 and Pn (1) = pn

  • Derivative

The tangent (first derivative) of a Bézier curve is:

  • Tangents at the endpoints

The tangent vector at the endpoints are parallel to the first and last edge of its

  • V. Properties of Bézier Curves (3)

1 1 1

( ) ( )( )

n n n i i i i

d t n B t dt P p p

− − + =

= −

Graphics & Visualization: Principles & Algorithms Chapter 7

The tangent vector at the endpoints are parallel to the first and last edge of its

control polygon:

If the curve is defined over an arbitrary parametric interval u

[a, b] , then:

17

1 1

and (0) ( ) (1) ( )

n n n n

d d n n dt dt

= − = − P p p P p p

1 1

1 ( ) (0) ( ) 1 ( ) (1) ( )

n n n n n n

d d dt a n du dt du b a d d dt b n du dt du b a

= = − − = = − − P P p p P P p p

slide-18
SLIDE 18
  • Second derivatives at the endpoints

The second derivatives at the endpoints of an nth-degree Bézier curve are:

  • V. Properties of Bézier Curves (4)

2 2 1 2 2 1 2 2

(0) ( 1)( 2 ) (1) ( 1)( 2 )

n n n n n

d n n dt d n n dt

− −

= − − + = − − + P p p p P p p p

Graphics & Visualization: Principles & Algorithms Chapter 7

If the curve is defined over an arbitrary parametric interval u

[a, b], then:

18

2 2 1 2 2 2 1 2 2 2

1 ( ) ( 1)( 2 ) ( ) 1 ( ) ( 1)( 2 ) ( )

n n n n n

d a n n du b a d b n n du b a

− −

= − − + − = − − + − P p p p P p p p

slide-19
SLIDE 19
  • Pseudo-local control

Local control: moving a control point has a localized effect on the

curve

Bézier curves do not possess local control since the Bernstein

polynomials are non-zero over the whole parametric interval [0,1] of the curve

Moving any control point affects the shape of the whole curve

  • V. Properties of Bézier Curves (5)

Graphics & Visualization: Principles & Algorithms Chapter 7

Moving any control point affects the shape of the whole curve

Bézier curves posses pseudo-local control:

the effect of moving pi is more pronounced around the parametric value i/n, where has its only maximum

Makes it easier to predict the change of the shape of a Bézier curve

when moving its control points

19

( )

n i

B t

slide-20
SLIDE 20
  • Consider cubic Bézier curve P3(t)
  • VI. Bézier Curve Subdivision

p

1

p

1

p

1 1

p

2

p

1 2

p

3

p

2

p

2 1

p

3 3

( ) t

  • p

P Graphics & Visualization: Principles & Algorithms Chapter 7

  • Consider cubic Bézier curve P3(t)
  • Any specific parametric value t0

[0,1] divides the curve into 2 segments:

The “left” one with endpoints P3(0) = p0 and P3(t0) The “right” one with end points P3(t0) and P3(1) = p3

  • These segments are both cubic curves
  • Can be written in Bézier curve form
  • Aim: determine the Bézier control points of these 2 segments

20

slide-21
SLIDE 21
  • First work on the left segment, L

Call its control points li, i = 0, 1, 2, 3 so that

  • Use a local parameter t΄ for L, t ≠ t΄ , so that L(t΄) traces the whole

left segment when t΄ [0,1]

  • The curve interpolates its endpoints, so the first and last control

point can be determined immediately:

  • VI. Bézier Curve Subdivision (2)

3 3

( ) ( ) , [0,1]

i i i

t B t t

=

′ ′ ′ = ∈

L l

3 3 3

(0) ( ) , ( ) ( ) t t t = = = = = l p P p l P p

Graphics & Visualization: Principles & Algorithms Chapter 7

  • For l1 : it is involved in the tangent of L(t΄) for t΄ = 0

P3 and L have the same tangent at this point, since they coincide when t [0, t0], so

21

3 3 3 3

(0) ( ) , ( ) ( ) t t t = = = = = l p P p l P p

3 1 1 1 1

1 (0) (0) (0) 3( ) 3( ) (1 ) d d d dt dt dt dt dt t t t ′ = = ⇔ − = − ′ ⇔ = − + P L L p p l l l p p

slide-22
SLIDE 22
  • Using the notation of the de Casteljau algorithm
  • Similarly, l2 is involved in the second derivative of L(t΄), for t=0:
  • VI. Bézier Curve Subdivision (3)

1 1

( ) t = l p

2 1 2 1 2 2 2 2 1 2

1 6( 2 ) 6( 2 ) (1 ) 2 (1 ) t t t t t − + = − + ⇔ = − + − + p p p l l l l p p p

Graphics & Visualization: Principles & Algorithms Chapter 7

  • Using the notation of the de Casteljau algorithm
  • The above relations can be written as:
  • The control points li of the left segment are exactly the points of the first

line of the de Casteljau triangle.

  • The above property holds for Bézier curves of any degree n.

22

2 2

( ) t = l p

( )

i i

t = l p

slide-23
SLIDE 23
  • The right segment:

Is the part that corresponds to the interval [t0,1] of the curve Its control points ri can be computed by working similarly , so: They are the points of the “hypotenuse” of the de Casteljau triangle This result holds for Bézier curves of any degree.

  • VI. Bézier Curve Subdivision (4)

( )

n i i i

t

= r p

Graphics & Visualization: Principles & Algorithms Chapter 7

  • The de Casteljau algorithm:

Not only computes the points to the curve that corresponds to t0 But also provides the control points of the 2 segments into which the curve

is subdivided by this point

The implementation readily provides points ri (they are the deCasPt) To provide points li: after each column of the triangle is completed, its 0-

index element is a control point of the left segment

23

slide-24
SLIDE 24
  • The subdivision of a Bézier curve can be repeated recursively for

each of the two segments of the curve

  • The control points generated during this recursion converge to

initial curve

  • This convergence is rather fast
  • The result has interesting practical applications:

It is a way to draw Bézier curves

  • VI. Bézier Curve Subdivision- Applications

Graphics & Visualization: Principles & Algorithms Chapter 7

It is a way to draw Bézier curves

Subdivide recursively the curve into two segments After a number of steps the control points will be nearly collinear Then the subdivision may stop Each segment can be drawn as a line segment between its two endpoints

24

slide-25
SLIDE 25
  • This process is adaptive

draw its flat regions quickly perform more recursive steps wherever the curve has high curvature

  • Subdivision may be performed at any value t0

Prefer t0=1/2 because interpolation steps involve only divisions by 2

  • Test the collinearity of the control points p0, pn by

computing the distance of every other control points pi, i=1,2,…,n-1

  • VI. Bézier Curve Subdivision- Applications (2)

Graphics & Visualization: Principles & Algorithms Chapter 7

computing the distance of every other control points pi, i=1,2,…,n-1 ensuring that every such distance is less than the required tolerance

  • The distance of a control point pi from the line through p0 and pn :

25

( ) ( )

n n i n

d − × − = − p p p p p p

slide-26
SLIDE 26

Finding the intersection of a Bézier curve with a line

  • Recursive algorithm:

Construct the axis-aligned bounding box (AABB) of the initial curve Check the (AABB) for intersections with the line if exists an intersection subdivide the curve into its left & right segment continue recursively with the AABB of each segment

  • Subdivision stops when the AABB is too small (for given tolerance)
  • VI. Bézier Curve Subdivision- Applications (3)

Graphics & Visualization: Principles & Algorithms Chapter 7

  • Subdivision stops when the AABB is too small (for given tolerance)
  • The algorithm works correctly:

If the line does not intersect the AABB, it will not intersect the curve

26

slide-27
SLIDE 27
  • The complexity of the shape of a Bézier curve is restricted by the

number of its control points.

  • To draw complex shapes we need Bézier curves of high degree
  • The use of high-degree Bézier curves is not advisable:

The higher the degree, the less efficient is to compute it

(more linear interpolation steps, numerical accuracy problems)

The lack of local control makes it difficult to create a desirable shape with a

VII.Smoothly Joining Bézier Curves

Graphics & Visualization: Principles & Algorithms Chapter 7

The lack of local control makes it difficult to create a desirable shape with a

single Bézier curve

  • Bézier curves of degree > 5 are not used in practice
  • Solution: use low-degree curves joined in such a way that the

resulting shape is smooth

  • Most common form is B-spline curve (presented later)
  • Here, we discuss the joining of 2 Bézier curves smoothly

27

slide-28
SLIDE 28
  • Two polynomial curves F(t), t [t0,t1] and G(t), t [t1,t2] join with

parametric continuity Cr at t1 if their rth-order derivatives are equal at t1:

  • Cr continuity at a point Cm continuity for all 0 ≤ m < r
  • E.g. if F(t) and G(t) join at t1 with C2 continuity, then their

values (C0),

VII.Smoothly Joining Bézier Curves (2)

∈ ∈

( ) ( ) 1 1

( ) ( )

r r

t t = F G

Graphics & Visualization: Principles & Algorithms Chapter 7

values (C0), tangents (C1) and second derivatives (C2)

  • This join is “smooth”: the slope of the curve at the join does not

change abruptly

  • For kth-degree polynomial curves look for continuity up to Ck-1,

because their kth-order derivatives are constant & higher order

  • nes are 0.

28

are equal at t1

slide-29
SLIDE 29
  • Consider two Bézier curves:

Pn(t) , t

[0,1] of degree n with control points p0, p1, …, pn

Qm(t), t

[1,2] of degree m with control points q0, q1, …, qm

  • Which are the conditions for the curves to join at t=1 with C2

continuity?

  • 1. C0 continuity:
  • 2. C1 continuity: (1)

VII.Smoothly Joining Bézier Curves (3)

∈ ∈

n =

p q

n − = − ⇔ − = −

Graphics & Visualization: Principles & Algorithms Chapter 7

  • 2. C1 continuity: (1)

q1 must be placed at the line (pn-1pn)and its distance from pn is (1)

  • 3. C2 continuity: (2)

to define the position of q2

  • If n = m then (1) becomes

29

1 1 1 1

( ) ( ) ( )

n n n n n

n n m m

− −

− = − ⇔ − = − p p q q q p p p

1 2 2 1

( 1)( 2 ) ( 1)( 2 )

n n n

n n m m

− −

− − + = − − + p p p q q q

1 1 1 1

so

n n n n n n− −

− = − = q p q p p p p p

slide-30
SLIDE 30
  • If n = m = 3 then (2) becomes:

If then d must be placed so that q2 must be placed so that

  • Each additional degree of continuity restricts the

position of one more control point.

VII.Smoothly Joining Bézier Curves (4)

2 1 1 2

2 2 − = − q q p p

2 1 1 2

2 2 = − = − d q q p p

2 2 1

= dp p p

1 1 2

= dq q q

p

1

p

3

q

2

p

1

q

2

q

3

  • p

q

p

1

p

3

q

Graphics & Visualization: Principles & Algorithms Chapter 7

  • For n=m=3 with C2 continuity, only the position
  • f p0 and q3 is free.
  • For greater flexibility:

Use higher-degree curves (not efficient) Require lower continuity (not satisfying results) Modify the kind of continuity required :

instead of parametric continuity (Cr) require the weaker geometric continuity (Gr)

30

2

q

1

q

2

p

3

  • p

q

2

q

1

q p

1

p

3

q

2

p d

3

  • p

q

slide-31
SLIDE 31
  • Spline curves: curves generated by joining parametric curves with

continuity constraints (cf. last section)

  • B-spline curves:

Spline curves comprised of polynomial segments of degree k joined with

Ck-1 continuity

The degree k of the segments is also the degree of the B-spline curve Are defined by control points p0, p1, …, pn

B-Spline Curves

Graphics & Visualization: Principles & Algorithms Chapter 7

Are defined by control points p0, p1, …, pn

The number (n+1) of control points is independent of the curve degree

and related to the number of the polynomial segments

The polynomial segments are defined over consecutive parametric intervals

[ti, ti+1]

Domain of the B-spline curve: the union [tmin, tmax] of the intervals

31

slide-32
SLIDE 32
  • Knots of the curve: the values ti at the boundaries of the intervals
  • A B-spline curve has a knot sequence

because its definition requires some additional knots outside its domain.

B-Spline Curves (2)

... ... ...

first min max last

t t t t ≤ ≤ ≤ ≤ ≤ ≤

Graphics & Visualization: Principles & Algorithms Chapter 7

  • The number of knots depends on:

The degree of the curve The number of its control points 32

slide-33
SLIDE 33

I. Quadratic B-Spline Curves II. kth-Degree B-Spline Curves

  • III. B-Spline Functions
  • IV. The de Boor Algorithm
  • V. Knots and Parameterizations
  • VI. Properties of B-Spline Curves

B-Spline Curves

Graphics & Visualization: Principles & Algorithms Chapter 7

  • VI. Properties of B-Spline Curves

VII.B-Spline Curves in Bézier Form

33

slide-34
SLIDE 34
  • A quadratic B-spline curve Q(t) is comprised of quadratic

segments Qi(t), defined in parametric intervals [ti, ti+1]

  • Use 3 control points for each segment
  • The 2 linear interpolation steps differ from those for Bézier curves
  • For segment Qi(t), use control points pi-2, pi-1 and pi

Step 1:

  • I. Quadratic B-Spline Curves

Graphics & Visualization: Principles & Algorithms Chapter 7

  • Interpolate separately

(pi-2, pi-1) in the interval [ti-1, ti+1] and (pi-1, pi) in the interval [ti, ti+2]

to get the intermediate points:

34 1 1 1 1 2 1 1 1 1 1 1 1 1 2 1 2 2 2

( ) , [ , ] ( ) , [ , ]

i i i i i i i i i i i i i i i i i i i i i i

t t t t t t t t t t t t t t t t t t t t t t t t

+ − − − − − + + − + − + − + + +

− − = + ∈ − − − − = + ∈ − − q p p q p p

slide-35
SLIDE 35

Step 2:

  • Interpolate and in the interval [ti , ti+1] :
  • Substitute and to get:
  • I. Quadratic B-Spline Curves (2)

2 1 1 1 1 1 1 1

( ) ( ) ( ) ( ), [ , ]

i i i i i i i i i i i i

t t t t t t t t t t t t t t t

+ − + + +

− − = = + ∈ − − Q q q q

1 1( ) i

t

q

1( ) i t

q

1 1( ) i

t

q

1( ) i t

q

t t t t t t t t t t t t t t t t

+ + + +

  − − − − − − − −    = + + +

(1)

Graphics & Visualization: Principles & Algorithms Chapter 7

  • C1 continuity:

They satisfy They join at ti+1 (C0) Their tangents coincide (C1)

35

1 1 1 2 1 2 1 1 1 1 1 1 1 1 2 1 2

( )

i i i i i i i i i i i i i i i i i i i i i i i i i i i i

t t t t t t t t t t t t t t t t t t t t t t t t t t t t t t t t t

+ + + + − − − + + − + + − + + + +

  − − − − − − − −    = + + +      − − − − − − − −   Q p p p

1 1 1 1 1 1

( ) ( ) and ( ) ( )

i i i i i i i i

t t t t

+ + + + + +

′ ′ = = Q Q Q Q

slide-36
SLIDE 36
  • (1) is not useful, provides a piecewise expression
  • Need for a uniform expression for the whole curve in terms of:

Its control points Its knots

  • Consider a single control point pi
  • pi affects three consecutive segments of the curve Qi(t), Qi+1(t)

and Q (t)

  • I. Quadratic B-Spline Curves (3)

Graphics & Visualization: Principles & Algorithms Chapter 7

and Qi+2(t)

36

slide-37
SLIDE 37
  • Rewrite (1) for segments Qi(t), Qi+1(t) and Qi+2(t)
  • I. Quadratic B-Spline Curves (4)

2 1 1 1 2 2 1 3 1 1 1 2 1 2 2 1 3 1

( ) , [ , ], ( )

i i i i i i i i i i i i i i i i i i i i i i i i i i i i i i

t t t t t a b t t t t t t t t t t t t t t t t a t t t t t t t t

− − + + + + + + + + − + + + + + + +

− − = + + ∈ − −   − − − −    = + + +      − − − −   Q p p p Q p p

1 1 1 2 3 3 2 2 1 2 2 2 3 3 2 3 1

, [ , ], ( ) , [ , ]

i i i i i i i i i i i i i i i i i i

c t t t t t t t t b c t t t t t t t

+ + + + + + + + + + + + + + + + +

∈ − − = + + ∈ − − p Q p p p

Graphics & Visualization: Principles & Algorithms Chapter 7

  • If we set

then the effect of pi on the whole curve is

37

3 2 3 1 i i i i

t t t t

+ + + +

− −

2( ) i i

N t p

slide-38
SLIDE 38
  • The quadratic B-spline curve can be written by summing the

effects of all control points: (3)

  • Determine necessary number of knots for quadratic B-spline curve:

Control points p0, p1, …, pn First segment Q2(t) uses p0, p1, p2 and requires knots t1, t2, t3, t4

Last segment Q (t) uses p , p , p and requires knots t

, t , t , t

  • I. Quadratic B-Spline Curves (5)

2

( ) ( )

n i i i

t N t

=

= ∑ Q p

Graphics & Visualization: Principles & Algorithms Chapter 7

Last segment Qn(t) uses pn-2, pn-1, pn and requires knots tn-1, tn, tn+1, tn+2

  • A quadratic B-spline curve with (n+1) control points p0, p1, …, pn

requires (n+2) knots t1, t2, …, tn+2

  • The domain of the curve is [t2, tn+1]
  • Two more knots are required (t0, tn+3) to define and

These knots don’t contribute to the shape of the curve

38

2 0( )

N t

2( ) n

N t

slide-39
SLIDE 39
  • Generalize the process for the generation of a quadratic B-spline curve

for higher-degree curves.

  • A segment Qi(t), t [ti, ti+1] of a kth-degree B-spline requires k linear

interpolation steps.

  • Step 1:

interpolate (k+1) control points pi-k, pi-k+1, pi in pairs

result: points , j=i-k+1, i-k+2,…, i , t [t t ] on linear segments

II. kth-Degree B-Spline Curves

∈ ∈

1 ( )

t q

Graphics & Visualization: Principles & Algorithms Chapter 7

result: points , j=i-k+1, i-k+2,…, i , t [tj, tj+k] on linear segments

  • Steps r = 2,3,…,k :

interpolate the points of previous step result: points , j=i-k+r, …, i , t

[tj, tj+k-r+1] on shrinking t

  • After k steps: a single kth-degree segment
  • Consecutive segments Qi(t): join with Ck-1 continuity and

form a kth-degree B-spline curve

39

∈ ∈

1 ( ) j t

q ( )

j r t

q

slide-40
SLIDE 40
  • Express the whole curve in terms of its control points & knots:

Each point pi affects (k+1) segments Qj(t), j=i, i+1, …, i+k Construct a function that expresses its contribution to the curve

  • are called kth-degree B-spline functions
  • The B-spline is written as:
  • It is comprised of (n-k+1) polynomial segments of degree k

II. kth-Degree B-Spline Curves (2)

( ) ( )

n k i i i

t N t

=

= ∑ Q p

( )

k i

N t ( )

k i

N t

Graphics & Visualization: Principles & Algorithms Chapter 7

  • It is comprised of (n-k+1) polynomial segments of degree k
  • Each segment is defined over the interval [ti, ti+1], i=k, k+1, …, n
  • The domain of the curve is [tk, tn+1]
  • There are (n + k) knots t1, t2, …, tn+k

“Dummy” Knots t0 and tn+k+1 needed for the definition of the but do not

affect the shape of the curve

Knots may be repeated At most k consecutive knots may be equal, ti < ti+k

40

( )

k i

N t

slide-41
SLIDE 41
  • : kth-degree B-spline functions:
  • For r = 1,2,…,k and i=0,1,…,n+k-r :
  • III. B-Spline Functions

( )

k i

N t

1

1, [ , ) ( ) 0, everywhere else

i i i

t t t N t

+

 ∈   =   

1 1 1

( ) ( ) ( )

r r r i i r

t t t t N t N t N t

− − + +

− − = +

Graphics & Visualization: Principles & Algorithms Chapter 7

  • are

r-degree polynomials of t with local support on [ti, ti+r+1 ), i.e. 0 everywhere

else

Spline functions because they consist of (r+1) polynomial segments of

degree r joined with Cr-1 continuity at the knots

41

( )

r i

N t

1 1 1 1 1 1

( ) ( ) ( )

r r r i i r i i i i r i i r i

t t t t N t N t N t t t t t

− − + + + + + + +

− − = + − −

slide-42
SLIDE 42
  • Each first-degree consists of 2 linear segments joined at ti+1

(C0)

  • III. B-Spline Functions

1( ) i

N t

1

N

1 1

N

1 2

N

1 3

N

2 4

N 35 . t 75 . 95 . 6 1 2 1 35 . t 95 . 105 . 6 1 2 1

2

N

2 1

N

2 2

N

2 3

N

2 4

N

Graphics & Visualization: Principles & Algorithms Chapter 7

  • Each second-degree consists of 3 quadratic segments joined

with C1 continuity at ti+1 and ti+2

  • Given a degree k and knots t0, t1, …, tn+k , tn+k+1 , all the spline

functions defined over this knot sequence constitute a vector space

  • The (n+1) B-spline functions of degree k defined over this knot

form a basis of this vector space

  • B-splines Basis splines

42

2( ) i

N t

slide-43
SLIDE 43
  • The de Casteljau algorithm computes points on a Bézier curve
  • The de Boor algorithm:

Computes points on a B-spline curve Summarizes the linear interpolation steps

  • Due to the local support, we must know the interval to which the

requested t belongs in order to compute Q(t) Steps :

  • IV. The de Boor Algorithm

Graphics & Visualization: Principles & Algorithms Chapter 7

Steps :

1. For the required value of t, find the parametric interval [ti, ti+1). The domain is [tk, tn+1] so i must satisfy k ≤ i ≤ n 2. Set 3. Perform the linear interpolation steps: 4. The point of the curve corresponding to t is:

43 0( )

, , 1,...,

j j

t j i k i k i = = − − + q p

1 1 1 1 1 1

( ) ( ) ( ), 1,2,...,

k r j j r r r j j j k r j j k r j j

t t t t t t t r k t t t t

− + + − − − − + + − + +

− − = + = − − q q q ( ) ( )

k i

t t = Q q

, 1,..., j i k r i k r i = − + − + +

slide-44
SLIDE 44
  • All the intermediate points can be written in a triangular

arrangement

  • For the case of a cubic B-spline curve:
  • IV. The de Boor Algorithm (2)

Graphics & Visualization: Principles & Algorithms Chapter 7

  • Differences from the de Casteljau triangle:
  • The coefficients involved in the linear interpolation steps are not constant

(1-t and t) – they depend on the specific row and column

  • When implemented with a one-dimensional array: the intermediate points

must be computed from bottom to top so that the required points are not

  • verwritten

44

slide-45
SLIDE 45

The de Boor Algorithm:

for (j = i-k; j <= i; j++) { m = j-i+k; //so that m = 0, 1, …, k-r deBoorPt[m] = controlPt[j]; } for (r = 1; r <= k; r++) { for (j = i; j >= i-k+r; j--) {

  • IV. The de Boor Algorithm (3)

Graphics & Visualization: Principles & Algorithms Chapter 7

for (j = i; j >= i-k+r; j--) { m = j-i+k; coeff = (t-knots[j]) / (knots[k-r+1+j] - knots[j]); deBoorPt[m] = (1-coeff)*deBoorPt[m-1] + coeff*deBoorPt[m]; } }

45

slide-46
SLIDE 46
  • The knot sequence of a B-spline curve directly affects its shape
  • Using the same control points and different knot sequences, the shape of

the curves will vary.

  • A knot has multiplicity k : it is repeated k times
  • If for a kth-degree B-spline the first knot has multiplicity k

(t1=t2=…= tk-1= tk) then

  • Q(t1) = Q(tk) = q0
  • V. Properties of the Knots

Graphics & Visualization: Principles & Algorithms Chapter 7

  • Q(t1) = Q(tk) = q0
  • The curve interpolates its first control point
  • If the last knot has multiplicity k, the curve interpolates its last

control point pn.

  • Open or clamped: is a knot sequence if the first and last k knots

are equal

  • Unlike Bézier curves, B-splines interpolate their extreme control

points only when a clamped knot sequence is used

46

slide-47
SLIDE 47
  • If a knot is repeated, ti = ti+1, the curve loses 1 degree of

continuity at Q(ti)

  • If a knot has multiplicity r, the curve is Ck-r at that point
  • V. Properties of the Knots (2)

1

2

N

2 1

N

2 2

N

2 3

N

2 4

N

Graphics & Visualization: Principles & Algorithms Chapter 7

  • The B-spline functions above are not C1 continuous everywhere

but C0 continuous at the double knot.

47

35 . t 95 . 105 . 6 1 2

slide-48
SLIDE 48
  • As the multiplicity of a knot increases, the curve approaches its

control polygon in the neighborhood of this knot

  • When multiplicity of the knot == degree of the curve :
  • A cusp is formed at that control point since the curve is only C0 continuous
  • The above property helps in practice, to better control the shape of the

curve

  • No knot can be repeated more than k times
  • V. Properties of the Knots (3)

Graphics & Visualization: Principles & Algorithms Chapter 7

  • No knot can be repeated more than k times
  • lower than C0 continuity discontinuity on the curve

48

[1,1,1,2,3,4,5,5,5] [1,1,1,2,2,4,5,5,5] [1,1,1,2,2,2,5,5,5] p

1

p

2

p

3

p

4

p

5

p

6

p

slide-49
SLIDE 49
  • Knot sequence can:
  • Be supplied by the user
  • Be generated automatically
  • Parameterizations: specific algorithms that generate the knot sequence
  • They try to produce a well-shaped curve
  • V. Parameterizations

Graphics & Visualization: Principles & Algorithms Chapter 7 49

slide-50
SLIDE 50

Uniform parameterization

  • The knots are equidistant
  • Set: ti = i-1, i = 1, 2, …, n+k

Clamped uniform parameterization

  • Used so that the curve interpolates its first & last endpoints
  • V. Parameterizations (2)

0, 1,..., i k  =   

Graphics & Visualization: Principles & Algorithms Chapter 7

  • Uniform knot sequences:
  • Generate visually acceptable curves in most cases
  • They don’t take into account the shape of the curve
  • May not produce well-shaped, “smooth” curves

  • eg. if control points are close to each other at areas where the curvature

changes abruptly

50

0, 1,..., , 1,..., 1, 1,...,

i

i k t i k i k n n k i n n k  =     = − = +    − + = + +   

slide-51
SLIDE 51

Chord-length parameterization

  • Often used in practice
  • The distances between the knots are proportional to the distances

between corresponding control points

  • V. Parameterizations (3)

1 1

0 , 1,..., , 1,...,

i i k i k i

i k t i k n t p p

− − − −

 =     + − = +   =  

Graphics & Visualization: Principles & Algorithms Chapter 7

  • Different chord-length parameterizations can be produced by:
  • Changing the extreme knots

and / or

  • Not requiring that the curve interpolates its first and last control

points

51

1

, 1,...,

i n k j j j

t i n n k p p

− + =

 =    − = + +     ∑

slide-52
SLIDE 52

Centripetal parameterization

  • The distances between the knots are proportional to the square

root of the distances between corresponding control points

  • V. Parameterizations (4)

1 1

0, 1,..., , 1,...,

i i i k i k

i k t t i k n

− − − −

     =     = + − = +    p p

Graphics & Visualization: Principles & Algorithms Chapter 7

  • Different centripetal parameterizations can be produced by:
  • Changing the end conditions

52

1 1 1

, 1,..., , 1,...,

i i i k i k n k j j j

t t i k n i n n k

− − − − − + =

= + − = +       − = + +    ∑ p p p p

slide-53
SLIDE 53
  • Add a knot sequence while maintaining its shape
  • When inserting a knot one of the following must increase by 1:
  • The degree of the curve OR
  • The number of its control points

so that the correlation between the degree, the number of control points and knots is maintained.

  • High-degree curves are difficult to compute & manipulate, so prefer to:
  • V. Knot insertion

Graphics & Visualization: Principles & Algorithms Chapter 7

  • High-degree curves are difficult to compute & manipulate, so prefer to:
  • Add a new control point and
  • Move some others to maintain the shape of the curve
  • The new knot & control point provide grater flexibility to the shape
  • As knots are inserted, the control polygon comes closer to the curve

53

slide-54
SLIDE 54
  • Insert a new knot s between knots ti and ti+1:
  • The new knot sequence will be t1, …, ti, s, ti+1, …, tn+k
  • Let rj, j=0, 1, …, n+1 be the new control points
  • Only k of the new control points will differ because a control point pi only

affects the curve on [ti, ti+k+1] where ≠ 0

  • The control points that are not affected are:
  • V. Knot insertion (2)

( )

k i

N t

1 1

  • p

r

2

p

2

r r

5 6

  • p

r Graphics & Visualization: Principles & Algorithms Chapter 7

  • The control points that are not affected are:
  • The new control points are rj , j = i-k+1, …, i
  • This formula is called Boehm’s knot-insertion formula

54 1

, 0,..., , 1, , 1

j j j j

j i k j i n

= = − = = + … + r p r p

1

, 1,...,

j k j j j j j k j j k j

t s s t j i k i t t t t

+ − + +

− − = + = − + − − r p p

  • p

r

1 1 3

p

3

r

4

r

4 5

  • p

r

slide-55
SLIDE 55
  • Local control
  • B-splines exhibit full local control
  • Changing a control point, affects the shape of the curve only on a restricted

segment

  • pi affects only the part of the curve corresponding to [ti, ti+k+1]: ≠ 0
  • Strong convex-hull property
  • All the interpolation steps performed, are convex combinations of the control
  • VI. Properties of B-Spline Curves

( )

k i

N t

Graphics & Visualization: Principles & Algorithms Chapter 7

All the interpolation steps performed, are convex combinations of the control points

  • Every point on the curve lies inside the convex hull of the (k+1) control points

that contribute to its computation

  • The whole curve lies inside the union of these convex hulls

55

slide-56
SLIDE 56
  • Invariance under affine transformations
  • The B-spline curve is an affine combination of its control points
  • To apply an affine transformation to a B-spline transform only its control

points

  • Parameterizations are not maintained
  • Only the uniform parameterization is maintained
  • Invariance under affine transformations of its parameter
  • VI. Properties of B-Spline Curves (2)

Graphics & Visualization: Principles & Algorithms Chapter 7

  • Invariance under affine transformations of its parameter
  • The curve remains invariant if u = a + (b-a) t
  • Parameterizations are not maintained, except the uniform
  • Strong linear precision
  • If the control points lie on a straight line, then the curve degenerates to a

straight line

  • If (k+1) control points are collinear, the corresponding segment is a straight line

segment

56

slide-57
SLIDE 57
  • Strong variation-diminishing property
  • General form:

A planar B-spline curve may not be intersected by an arbitrary straight line more times than its control polygon

A non-planar B-spline curve may not be intersected by a straight line or plane more times than its control polygon

Stronger form

  • VI. Properties of B-Spline Curves (3)

Graphics & Visualization: Principles & Algorithms Chapter 7

  • Stronger form

The above hold for the polygon formed by the (k+1) control points that contribute to any point on the curve

  • Endpoint interpolation
  • A B-spline curve interpolates its extreme control points only if a clamped

knot sequence is used

57

slide-58
SLIDE 58
  • Derivative
  • The tangent (first derivative ) of a kth-degree B-spline curve is:
  • Generation of Bézier curves
  • VI. Properties of B-Spline Curves (4)

1 1 1 1 1

1 ( ) ( ) ( )

n k i i i i i k i

d t k N t dt t t

− − + = + + +

= − −

Q p p

Graphics & Visualization: Principles & Algorithms Chapter 7

  • Generation of Bézier curves
  • A B-spline of degree k with (k+1) control points p0, p1, …, pk and knot

sequence (0<k>, 1<k>) is a Bézier curve of degree k and control points p0, p1, …, pk

  • x<k> : a knot with multiplicity k

58

slide-59
SLIDE 59
  • A kth-degree B-spline is composed of several kth-degree

polynomial segments defined over [ti, ti+1]

  • Each of these segments can be written as a kth-degree Bézier curve
  • Obtaining a piecewise Bézier form of a B-spline curve is useful:
  • Bézier curves are simpler and well-studied

VII.B-Spline Curves in Bézier Form

Graphics & Visualization: Principles & Algorithms Chapter 7

  • Draw a B-spline curve by drawing the Bézier curves

59

slide-60
SLIDE 60
  • Consider :
  • A quadratic (k=2) B-spline Q(t)
  • A specific segment Qi(t) defined from (B-spline) control points pi-2, pi-1, pi
  • In Bézier form Qi(t) is defined over [ti, ti+1] by a 3 (Bézier) control

points r0, r1, r2

  • r0 and r2 are the endpoints of this segment Qi(ti) and Qi(ti+1)
  • r coincides with the B-spline control point p

VII.Bézier Form of Quadratic B-splines

Graphics & Visualization: Principles & Algorithms Chapter 7

  • r1 coincides with the B-spline control point pi-1
  • Using the notation of the de Boor algorithm:

60 1 1 1 2 1 1 1 1 1 1 1 1 1 2 1 1 2 1 1 1 2 2

( ) ( ) ( ) ( )

i i i i i i i i i i i i i i i i i i i i i i i i i i i i i

t t t t t t t t t t t t t t t t t t t t

+ − − − − + − + − − + + + + − + + +

− − = = + = − − = − − = = + = − − r Q p p q r p r Q p p q

slide-61
SLIDE 61
  • Consider :
  • A cubic (k=3) B-spline Q(t)
  • A specific segment Qi(t) defined from (B-spline) control points pi-3, pi-2, pi-1, pi
  • ver [ti, ti+1]
  • In Bézier form Qi(t) is defined by a 4 (Bézier) control points r0, r1, r2, r3
  • r0 and r3 are the endpoints of this segment Qi(ti) and Qi(ti+1)
  • The middle control points are some of the intermediate points generated

VII.Bézier Form of Cubic B-splines

Graphics & Visualization: Principles & Algorithms Chapter 7

  • The middle control points are some of the intermediate points generated

during the interpolation steps.

  • Using the notation of the de Boor algorithm:

61

1 1 2 1 3 2 1 1 1 1 2 1 2 1 1 1 2 1 1 1 2 1 2 1 2 1 1 2 1 1 1 2 1 1 2 2 1 2

( ) ( )

i i i i i i i i i i i i i i i i i i i i i i i i i i i i i i i i i i i i i i i i i

t t t t t t t t t t t t t t t t t t t t t t t t t t t t t t t t t t

+ + − − − − + − + − + − + − + − − − − + − + − + + + − − + − + − + −

  − − − −    = + +      − − − −   − − = = + − − − − = = + − − r p p r r q p p r q p

1 1 2 1 1 3 1 1 3 2 1 2 2 3 3 i i i i i i i i i i i i i i i i i i i

t t t t t t t t t t t t t t t t

− + + + + + + − + + + +

− − −      − = + +       − − − −  p r r p p

slide-62
SLIDE 62
  • Bézier and B-Spline curves are the basic parametric curves used
  • There are 2 disadvantages:

Not invariant to projection transformations not handled easily in a 3D graphics scene Cannot represent conic sections (circles, ellipses, parabolas, hyperbolas) except for parabolas

  • Problems are overcome by rational Bézier & B-Spline curves

Rational Bézier & B-Spline Curves

Graphics & Visualization: Principles & Algorithms Chapter 7 62

  • Problems are overcome by rational Bézier & B-Spline curves
  • Rational

curves are polynomial parametric curves that use homogeneous coordinates

  • Given a polynomial curve X(t)=[x(t), y(t), z(t)]T (z(t)=0 for planar

curves), we construct: Xh(t)=[w(t) x(t), w(t)y(t), w(t)z(t), w(t)]T

  • If w(t) is constant for each t, we get the original X(t)
  • Definition of rational Bézier & B-spline curves is straightforward

since the coordinates are independent

slide-63
SLIDE 63
  • Consider a sequence of homogeneous control points:

i=0,…,n. A homogeneous Bézier curve can be defined as:

Rational Bézier Curves

[ , ] [ , , , ]

h T T i i i i i i i i i i i

w w w x w y w z w = = p p

( ) ( ) ( ) ( )

n n i i i n i h n h i i n i n

B t w t B t B t w p P p

= =

        = =      

∑ ∑ ∑

Graphics & Visualization: Principles & Algorithms Chapter 7 63

  • By dividing all coordinates by the homogeneous one, we get the

usual Cartesian form:

( )

i n i i i

B t w

= =

     

1 ( ) ( ) ( )

n r n i i i n n i i i i

t B t w B t w P p

= =

=

∑ ∑

slide-64
SLIDE 64
  • The above is a nth-degree rational Bézier curve , pi are the

Cartesian control points and wi are the respective weights

  • wi affects the contribution of the corresponding pi to the curve
  • As wi increases the curve is pulled towards pi
  • Ratio of various wi is of interest and not their absolute values

Common factors are ruled out due to the division

  • If all weights are equal we have a normal Bézier curve

Rational Bézier Curves (2)

Graphics & Visualization: Principles & Algorithms Chapter 7 64

  • If all weights are equal we have a normal Bézier curve
  • Weights are positive negative weights have unpredictable and

undesirable effect on the shape of the curve:

Convex-hull property is not maintained Poles, that make the curve go to infinity, may be created

  • Weights offer an additional level of local control on the shape of

the curve

slide-65
SLIDE 65
  • Effects of different weights to the shape of rational Bézier curve:

Rational Bézier Curves (3)

Graphics & Visualization: Principles & Algorithms Chapter 7 65

  • A rational Bézier curve Pr(t) is the perspective projection of the

homogeneous Ph(t), on the plane w = 1

  • Rational Bézier curves retain most of the properties of normal

Bézier curves:

Convex – hull hold if the weights Variation – diminishing are non - negative

}

slide-66
SLIDE 66
  • Rational Bézier curves are invariant under affine/projective

transformations (since they are themselves projection of the homogeneous curves) to project a rational Bézier curve it suffices to project its control points

  • Rational Bézier curves can be evaluated using de Casteljau

algorithm for the homogeneous control points pi

h

and performing the homogeneous division at the end

Rational Bézier Curves (4)

Graphics & Visualization: Principles & Algorithms Chapter 7 66

performing the homogeneous division at the end

  • Alternative formulation: perform division at each step:

Numerical accuracy Increased computational complexity

slide-67
SLIDE 67
  • Conic sections are the various curves resulting from the

intersection of a plane at a cone at different angles

  • Their algebraic equation have the common form:

Ax2+Bxy+Cy2+Dx+Ey+F = 0 with the following constraints for each kind of curve:

If B2 – 4AC < 0, the curve is an ellipse If in addition, B = 0 and A = C, the curve is a circle

Conic Sections as Rational Bézier Curves

Graphics & Visualization: Principles & Algorithms Chapter 7 67

◆ If in addition, B = 0 and A = C, the curve is a circle

If B2 – 4AC = 0, the curve is a parabola If B2 – 4AC > 0, the curve is a hyperbola

  • Parabola is the only conic section that can be represented by a

non-rational polynomial parametric equation

  • Other conic sections can only be represented by rational curves

(rational quadratic Bézier curves)

slide-68
SLIDE 68
  • A rational quadratic Bézier curve with non-collinear control

points p0, p1, p2 and corresponding weights 1, w1, 1 is:

An elliptical segment, if | w1 | < 1 A parabolic segment, if | w1 | = 1 (normal Bézier curve) A hyperbolic segment, if | w1 | > 1

Conic Sections as Rational Bézier Curves (2)

Graphics & Visualization: Principles & Algorithms Chapter 7 68

Solid segments: w1 > 0; dashed segments: w1 < 0

slide-69
SLIDE 69
  • Circular arcs deserve special attention:

The control polygon must be an isosceles triangle |p0p1| = |p1p2| w1 = sinθ, where θ is the half-angle between p0p1 and p1p2

Conic Sections as Rational Bézier Curves (3)

Graphics & Visualization: Principles & Algorithms Chapter 7 69

slide-70
SLIDE 70
  • Given a sequence of control points pi, i=0,…,n, a sequence of

corresponding weights wi, i=0,…,n and a knot sequence ti, i=0,…,n+k, a rational B-Spline curve of degree k is given by:

  • Rational B-Spline curves with arbitrary knot sequence are

Rational B-Spline Curves - NURBS

1 ( ) ( ) ( )

n r n i i i n n i i i i

t N t w N t w

= =

=

∑ ∑

Q p

Graphics & Visualization: Principles & Algorithms Chapter 7 70

  • Rational B-Spline curves with arbitrary knot sequence are

referred to as NURBS (non-uniform rational B-Splines)

  • NURBS retain most of the properties of B-Spline curves:

Strong convex – hull hold if the weights Strong variation – diminishing are non - negative

  • NURBS are invariant under affine/projective transformations

}

slide-71
SLIDE 71
  • Weights have the same properties as rational Bézier curves
  • ffer flexibility to the designer
  • NURBS are the most general of all curve representations up to

this point

  • They can represent:

Simple B-Spline curves (equal weights) Simple and rational Bézier curves

Rational B-Spline Curves – NURBS (2)

Graphics & Visualization: Principles & Algorithms Chapter 7 71

Simple and rational Bézier curves Conic sections

  • NURBS possess all properties of the other types of curves
  • NURBS are the standard tool in CAGD applications
slide-72
SLIDE 72
  • Bézier and B–Spline curves are approximation curves:

They do not pass through their control points The control points only provide a good indication of their shape

  • Need to construct interpolation curves:

Curves that pass through given points

  • Interpolation problem: Given a set of points p0, p1, …, pn and

corresponding parametric values t0, t1, …, tn, find a parametric

Interpolation Curves

Graphics & Visualization: Principles & Algorithms Chapter 7 72

corresponding parametric values t0, t1, …, tn, find a parametric curve P(t) that satisfies: P(ti) = pi, i = 0, 1, …, n

slide-73
SLIDE 73
  • Simple

interpolation methods construct P(t) as a single polynomial curve of degree n

  • P(t) is a unique curve

Defined by the (n+1) coefficients of the respective polynomials, which can be computed as the single solution of the linear system of (n+1) equations formed as shown above

  • Solving a linear system in order to determine the interpolation

Interpolation Curves (2)

Graphics & Visualization: Principles & Algorithms Chapter 7 73

  • Solving a linear system in order to determine the interpolation

curve is not practical. Other methods to find the curve:

Directly, by using Lagrange polynomials Recursively, by using Aitken’s algorithm

  • Despite the virtues of these methods there are still drawbacks

Interpolation of several points requires a high-degree polynomial complex and numerically unstable computations The generated curve exhibits oscillations and does not follow its control polygon in a predictable way

slide-74
SLIDE 74
  • Oscillation example:

Interpolation Curves (3)

Graphics & Visualization: Principles & Algorithms Chapter 7 74

  • To overcome these drawbacks:

interpolation is performed using curves comprised of several low-degree segments, joined together with continuity constraints

Interpolation with B-splines Hermite curves

slide-75
SLIDE 75
  • A way to construct an interpolation curve is using the nth-degree

Lagrange polynomials:

  • Then, the interpolation curve is:

Simple Polynomial Interpolation

( ) , 0,1,...,

n j n i j i j j i

t t L t i n t t

= ≠

− = = −

( ) ( ) ( )

n n i

t L t t =∑

i

P p

Graphics & Visualization: Principles & Algorithms Chapter 7 75

  • The i-th polynomial

is 0 on every knot tj except for the i-th knot ti which it is 1 P(t) is an interpolation curve

  • Further characteristics:

Invariance under affine transformations: holds since Lagrange polynomials sum to 1 interpolation curve is a barycentric combination

  • f its control points

( ) ( ) ( )

i i

t L t t

=

=∑

i

P p ( )

n i

L t

slide-76
SLIDE 76

No convex – hull property: Lagrange polynomials are neither always positive nor less than 1 the curve is not contained in the convex hull of its control points Linear precision: if all control points lie on a straight line, the curve has the shape of a straight line No variation–diminishing property: curve may demonstrate oscillations

  • Aitkens’ algorithm provides a recursive evaluation of the

interpolation curve:

Simple Polynomial Interpolation (2)

Graphics & Visualization: Principles & Algorithms Chapter 7 76

interpolation curve:

  • 1. For the required value t set:
  • 2. Perform the linear interpolation steps:
  • 3. Then, the point on the curve corresponding to parametric value t is:

0( )

, 0,1,...,

i i

t i n = = p p ( ) ( )

n

t t = P p

1 1 1

( ) ( ) ( ),

r r r i r i i i i i r i i r i

t t t t t t t t t t t

− − + + + +

− − = + − − p p p 1,2,..., , 0,1,..., r n i n r = = −

slide-77
SLIDE 77
  • Aitkens’ algorithm:

Simple Polynomial Interpolation (3)

Graphics & Visualization: Principles & Algorithms Chapter 7 77

  • In the interpolation steps parameter t is not always in [ti,ti+r]

the intermediate points generated are not convex combinations of the points in the previous step

slide-78
SLIDE 78
  • To solve the interpolation problem we need to find a curve that

passes through given points

  • However we may seek a curve that interpolates other elements

such as tangents

  • Cubic Hermite curves are required to interpolate given points

and to have given tangents at these points

  • Problem: Suppose that we are given 2 points p0, p1 and

corresponding tangent vectors . We are seeking the cubic

Cubic Hermite Interpolation

, m m

  • Graphics & Visualization: Principles & Algorithms Chapter 7

78

1

corresponding tangent vectors . We are seeking the cubic Hermite curve H(t), t [0, 1] that satisfies:

  • We express the Hermite curve in the form of a Bézier curve as:

for some unknown control points qi

1

, m m

  • ( )

( ) , [0,1]

n n i i i

t B t t

=

= ∈

H q

1 1

(0) , (0) , (1) , (1) ′ = = ′ = = H p H m H p H m

slide-79
SLIDE 79
  • Using properties of the Bézier curves:
  • Therefore the curve is:
  • Or expressing it with respect to its defining elements:

Cubic Hermite Interpolation (2)

1 3

(0) , (1) , = = = = p H q p H q

1 1 1 3 2 2 1 1

1 (0) 3( ) , 3 1 (1) 3( ) 3 m H q q q p m m H q q q p m

= = − ⇔ = + ′ = = − ⇔ = −

3 2 2 3 1 1 1

1 1 ( ) (1 ) 3 (1 ) ( ) 3 (1 )( ) 3 3 t t t t t t t = − + − + + − − + H p p m p m p

  • Graphics & Visualization: Principles & Algorithms Chapter 7

79

  • Or expressing it with respect to its defining elements:

where are the cubic Hermite polynomials:

  • In case the curve is defined over an arbitrary parametric interval

[a, b], these relations must be modified

3 3 3 3 1 1 2 3 1

( ) ( ) ( ) ( ) ( ) , [0,1] t H t H t H t H t t = + + + ∈ H p p m m

  • 3( )

i

H t

3 3 2 3 3 2 1 3 3 2 3 3 2 2

( ) 2 3 1, ( ) 2 3 , ( ) 2 , ( ) H t t t H t t t H t t t t H t t t = − + = − + = − + = −

slide-80
SLIDE 80
  • Hermite curves are not invariant to affine transformations of their parameter

their defining elements must be altered for the curve to remain the same, when parameter t [0,1] is changed to u [a, b]: We set u = (1-t)a + tb

  • The tangents at the endpoints are now:

Cubic Hermite Interpolation (3)

1

1 ( ) 3( ), 1 ( ) 3( ) a b a b ′ = = − − ′ = = − m H q q m H q q

Graphics & Visualization: Principles & Algorithms Chapter 7 80

  • Working as above we deduce that:
  • In order to obtain the curve in the desired form we need to

divide by (b-a)

Physical explanation: Using H(t) we traverse the curve in one time unit; if

we want to traverse it in (b-a) time units, our speed, represented by the tangent vectors, must be smaller by a factor of (b-a)

1 3 2

( ) 3( ) b b a ′ = = − − m H q q

3 3 3 3 1 1 2 3 1

( ) ( ) ( ) ( )( ) ( )( ) , [ , ] u H u H u H u b a H u b a u a b = + + − + − ∈ H p p m m

slide-81
SLIDE 81

Piecewise cubic Hermite interpolation:

  • Interpolating only 2 points and respecting tangent vectors has no

practical interest

  • More interesting is to construct a smooth curve that interpolates a

sequence of points p0, p1, …, pn and respective tangents vectors at parametric values t0, t1, …, tn

  • Possible to construct this curve as a piecewise cubic Hermite curve

Cubic Hermite Interpolation (4)

1

, ,...,

n

m m m

  • Graphics & Visualization: Principles & Algorithms Chapter 7

81

  • Independent Hermite segments, one for each parametric interval

[ti, ti+1], may be constructed

  • The segments will constitute a C1-continuous curve since they

share tangent vectors at their endpoints

  • Each segment will be given:

i

m

  • 3

3 3 3 1 1 2 1 3 1 1 1

( ) ( ) ( ) ( )( ) ( )( ) , [ , ]

i i i i i i i i i i i

u H u H u H u t t H u t t u t t H p p m m

  • +

+ + + +

= + + − + − ∈

slide-82
SLIDE 82
  • This construction of an interpolating curve provides flexibility:

It allows the modification of the shape of the curve by altering the tangent vectors Even more flexibility achieved, by requiring only G1 geometric continuity at the joins, allowing the tangent vectors at end of a segment and at the beginning of the next one to be multiple of each other instead of equal

Cubic Hermite Interpolation (5)

Graphics & Visualization: Principles & Algorithms Chapter 7 82

slide-83
SLIDE 83

Automatic generation of tangents:

  • In some situations, specifying the tangent vectors explicitly may

not be easy or desirable

  • An automatic method for computing tangent vectors is needed
  • Simplest methods seek a curve C1 continuous at the joins
  • More complicated methods produce C2 continuous curve

Cubic Hermite Interpolation (6)

Graphics & Visualization: Principles & Algorithms Chapter 7 83

slide-84
SLIDE 84

An approach to compute tangent vectors is to set parallel to the line through the 2 neighboring control points pi-1, pi+1: where c is a tension parameter that affects the norm of the tangent vectors

  • The curves generated using these tangent are called cardinal

Cubic Hermite Interpolation (7)

i

m

  • 1

1

1 (1 )( ), 1,2,..., 1 2

i i i

c i n

+ −

= − − = − m p p

  • Graphics & Visualization: Principles & Algorithms Chapter 7

84

  • The curves generated using these tangent are called cardinal

splines

  • If c = 0 then

and the curves are called Catmull- Rom splines

  • This procedure cannot determine tangents

at the first and last control points

1 1

1 ( ) 2

i i i + −

= − m p p

  • 0,

n

m m

slide-85
SLIDE 85

A second approach is to use Bessel tangents:

Tangent vector is set equal to the tangent of the parabola that interpolates the 3 neighboring points pi-1, pi, pi+1 If Qi(u), u [ti, ti+1] is this parabola (can be computed using Lagrange polynomials or Aitken’s algorithm) then:

Cubic Hermite Interpolation (8)

i

m

( ), 1,2,..., 1

i i i

d t i n du = = − m Q

  • Graphics & Visualization: Principles & Algorithms Chapter 7

85

For the first and last tangent vectors we may use the tangents of the first and last parabola respectively:

1 1

( ) and ( )

n n n

d d t t du du

= = m Q m Q

slide-86
SLIDE 86

We reach the following formulas for the tangent vectors in terms of the elements of the curve:

Cubic Hermite Interpolation (9)

2 1 2 1 1 2 2 1 2 1 1 2 1 2 1 1 1 1 1 1

2 ( )( ) ( )( ) ( )( ) 2 ( )( ) ( )( ) ( )( )

i i i i i i i i i i i

t t t t t t t t t t t t t t t t t t t t t t t t t t t t t t t t t t t t t t

+ + − − − +

− − + − − = + + − − − − − − − − + − = + + − − − − − − m p p p m p p p

  • Graphics & Visualization: Principles & Algorithms Chapter 7

86

Notice that Bessel tangents can be used independently, in order complement the tangents of cardinal splines mentioned above

0, n

m m

  • 1

1 1 1 1 1 1 1 1 1 1

( )( ) ( )( ) ( )( ) (

i i i i i i i i i i i i i i i i n n n n n

t t t t t t t t t t t t t t t t

− + + − − + − + + − −

− − − − − − − = − m

  • 2

1 2 2 1 2 1 2 1 1 2 1 2

2 )( ) ( )( ) ( )( )

n n n n n n n n n n n n n n n n n n

t t t t t t t t t t t t t t t

− − − − − − − − − − − − −

− − − − + − − − − − p p p

slide-87
SLIDE 87
  • The 2 previous methods generate C1 continuous curves
  • To create a C2 continuous curve, we must require that the second

derivatives of each pair of successive segments are equal at the joins

  • If Hi(u), u

[ti, ti+1] is the segment that interpolates pi, pi+1 the following must hold:

Cubic Hermite Interpolation (10)

2 2

( ) ( ) d d t t = H H

Graphics & Visualization: Principles & Algorithms Chapter 7 87

  • Using :

we differentiate the Hermite curve segments twice and get:

  • This relation holds for i=1,2,…,n-1 providing (n-1) equations for

the computation of the (n+1) tangent vectors i=0,1,…,n

1 2 2

( ) ( )

i i i i

d d t t du du

= H H

3 3 3 3 1 1 2 3 1

( ) ( ) ( ) ( )( ) ( )( ) , [ , ] u H u H u H u b a H u b a u a b = + + − + − ∈ H p p m m

  • 1

1 1 1 1 1 1 1 1 1 1 1

( ) 2( ) ( ) 3 ( ) 3 ( )

i i i i i i i i i i i i i i i i i i i i i

t t t t t t t t t t t t t t

+ − + − + − − + − + − +

− − − + − + − = − + − − − m m m p p p p

  • i

m

slide-88
SLIDE 88
  • 2 additional conditions must be used for the interpolation curve
  • Customary to apply conditions referring to the ends of the curve,

from which the values of are computed

  • Easiest approach:

Allow the user to supply arbitrary values for the 2 tangent vectors

  • Alternatively:

Geometric conditions, taking into account the shape of the curve near its ends, are applied

Cubic Hermite Interpolation (11)

0, n

m m

  • Graphics & Visualization: Principles & Algorithms Chapter 7

88

ends, are applied

  • Let us suppose that

are known

  • Using the previous equation, the linear system to be solved is:

0, n

m m

  • 1

1 1 1 1 1 1 1 1

1 ... 1 ... 1

n n n n n n n

α β γ α β γ

− − − − −

                              =                                      m c m c m c m c

⋱ ⋱ ⋱ ⋮ ⋮ ⋮

 

slide-89
SLIDE 89

where:

  • Solving this system we get tangent vectors

so that interpolating curve is C1 continuous

Cubic Hermite Interpolation (12)

1 1 1 1 1 1 1 1 1 1

( ), 2( ), 3 ( ) 3 ( ) ( ),

i i i i i i i i i i i i i i i i i i i i i i n n

t t t t t t t t t t t t t t α β γ

+ + − + − − + − + −

= − = − − = − = − + − − − = − = c m c p p p p c m

  • i

m

  • Graphics & Visualization: Principles & Algorithms Chapter 7

89

interpolating curve is C1 continuous

  • The system always has a unique solution
  • It is a tridiagonal system may be solved efficiently using a

direct method such as LU decomposition

slide-90
SLIDE 90

End conditions for C2 piecewise Hermite interpolation:

  • The additional conditions necessary to determine the tangents

for C2 piecewise Hermite curve involve tangent vectors called end conditions

  • Bessel end condition:

Bessel tangents, computed above for , are used so that the

Cubic Hermite Interpolation (13)

0, n

m m

  • 0,

n

m m

  • Graphics & Visualization: Principles & Algorithms Chapter 7

90

Bessel tangents, computed above for , are used so that the tangents at the ends are those of the parabolas that interpolate the first and last 3 control points It suffices to replace in the previous linear system with these expressions

0, n

m m

0, n

c c

slide-91
SLIDE 91
  • Quadratic end condition:

Requires that the 2nd derivatives of the interpolation curve at the first (and last) 2 knots are equal: By differentiating the Hermite curve twice, we can deduce that under this assumption:

Cubic Hermite Interpolation (14)

2 2 2 2 1 1 1 1 2 2 2 2

( ) ( ) and ( ) ( )

n n n n

d d d d t t t t du du du du

− − −

= = H H H H

1 1

2 and 2

n n− −

− − + = + = p p p p m m m m

  • Graphics & Visualization: Principles & Algorithms Chapter 7

91

These relations must be plugged into the linear system, replacing the first and last lines in full The system remains tridiagonal after the changes efficiently solved

1 1 1 1 1 1

2 and 2

n n n n n n

t t t t

− − −

+ = + = − − m m m m

slide-92
SLIDE 92
  • Physical end condition:

Requires that the 2nd derivatives are equal to 0 at the ends of the curve Then, the interpolation curve becomes a straight line near its ends (desirable or not, depending on application) The generated curve resembles the mechanical (physical) spline, which is pinned at its ends so that its curvature vanishes Working similarly to the quadratic end condition we get:

Cubic Hermite Interpolation (15)

− − p p p p

  • Graphics & Visualization: Principles & Algorithms Chapter 7

92

We should replace the first and last equation of the linear system, with these equations

1 1 1 1 1 1

2 3 and 2 3

n n n n n n

t t t t

− − −

− − + = + = − − p p p p m m m m

slide-93
SLIDE 93
  • Here it is shown how to construct a cubic B-Spline curve that

interpolates a set of given points

  • The interpolating B-Spline curve is denoted as Q(t)
  • We require that the given parametric values ti, at which the

curve interpolates points pi: Q(ti) = pi , i = 0, 1, …, n are also used as the knots of the B-Spline curve

Cubic B-Spline Interpolation

Graphics & Visualization: Principles & Algorithms Chapter 7 93

are also used as the knots of the B-Spline curve

  • Aim: Find the control points qi of this B–Spline curve
  • Suppose that pi are all different from each other ti should also

be different from each other

  • The first and last points are easy to interpolate, if a clamped knot

sequence is used

  • Therefore, we add knots t-2, t-1, tn+1, tn+2 such that:

2 1 1 2

= and =

n n n

t t t t t t

− − + +

= =

slide-94
SLIDE 94
  • Given this knot sequence, the control points are qi, i=-3,…,n-1

(indices are ranged according to the knots indices)

  • The first and last control points are already known:

q-3 = p0 and qn-1 = pn

  • For the remaining control points, we use the definition of the

cubic B-Spline curve: (E)

Cubic B-Spline Interpolation (2)

1 3

( ) ( ) , 1,2,..., 1

n j j i j i

t N t j n p Q q

= = = −

Graphics & Visualization: Principles & Algorithms Chapter 7 94

(E)

  • The value of the cubic B-Spline basis function

at the knots tj can be computed as follows:

First, evaluate the quadratic B-Spline basis function at the knots to get:

3 j j i j i i=−

3( ) i

N t

1 2 2 3 2 3 1

0, 1, , 1, ( ) , 2, 0, otherwise

i i i i i j i i i i

j t t j i t t N t t t j i t t

+ + + + + +

 =     −  = +   −   =  −  = +   −      

slide-95
SLIDE 95
  • Then we apply:

to get:

Cubic B-Spline Interpolation (3)

1 1 1 1 1 1

( ) ( ) ( )

r r r i r i i i i i r i i r i

t t t t N t N t N t t t t t

− − + + + + + + +

− − = + − −

1 1

, 1,

i i i i

t t t t j i t t t t

+ +

− − = + − −     

Graphics & Visualization: Principles & Algorithms Chapter 7 95

3 2 2 3 2 4 2 2 1 2 3 3 1 4 1 3 1 4 3 4 3 4 1 4

, 1, , 2, ( )

i i i i i i i i i i i i i i i i i i i i i j i i i i i i i

j i t t t t t t t t t t t t j i t t t t t t t t N t t t t t t t t

+ + + + + + + + + + + + + + + + + + + + + + +

= + − − − − − − + = + − − − − = − − −

2

, 3, 0, otherwise

i

j i t +               = +   −      

slide-96
SLIDE 96
  • Finally, we change the indices in order to get the

for a constant j and for a suitable i:

Cubic B-Spline Interpolation (4)

1 1 3 1 2 1 1 1 2 1 2 1 3 2 1 2 1 1 2 1 1 1

( ) , ( ) ,

j j j j j j j j j j j j j j j j j j j j j j j j j j j j

t t t t N t t t t t t t t t t t t t N t t t t t t t t t

− − − + − + − − + + − − + − + − + − + −

− − = − − − − − − = + − − − −

3( ) i

N t

Graphics & Visualization: Principles & Algorithms Chapter 7 96

  • Therefore, equation (E) becomes:

1 2 1 1 2 1 1 1 1 1 3 3 1 2 1 1

( ) ,

j j j j j j j j j j j j j j j j j j

t t t t N t t t t t

+ − + − + − + − + + − + − + −

− − = − −

3 3 3 3 3 2 2 1 1

( ) ( ) ( )

j j j j j j j j j j

N t N t N t p q q q

− − − − − −

= + +

slide-97
SLIDE 97
  • Substituting

we get:

Cubic B-Spline Interpolation (5)

3( ) i j

N t

2 1 3 1 1 2 1 2 1 2 1 2 2 1 2 1

( ) ( )( ) ( )( ) ( )

j j j j j j j j j j j j j j j j j j j j

t t t t t t t t t t t t t t t t t t q q

+ − + − − + + − − + − + − −

− −   − − − −   + +   − −     −

Graphics & Visualization: Principles & Algorithms Chapter 7 97

  • The above expressions together with the relations: q-3 = p0 and

qn-1 = pn provide a linear system with (n+1) unknowns for the determination of the (n+3) control points 2 more conditions are needed

  • Similar to the situation occurred when we required that a

Hermite interpolation curve be C2 at the joins of its segments

1 1 1 1 2 1

( ) ( )

j j j j j j j j

t t t t t t q p

− − + − + −

− + = − −

slide-98
SLIDE 98
  • The above is not accidental, since in both cases we seek a

piecewise cubic curve that is C2 continuous and interpolates (n+1) given points

  • Difference:

In the former case, the curve was expressed as a piecewise Hermite curve In the later case, it is given as a B-Spline curve

  • We assume that q-2, q-1 are known
  • The linear system can be written:

Cubic B-Spline Interpolation (6)

Graphics & Visualization: Principles & Algorithms Chapter 7 98

  • The linear system can be written:

1 1 1 n-1 n-1 n-1

1 ... 0 0 1 ... 0 ... 0 ... ⋮ ⋱ ⋱ ⋱ ⋮ α β γ α β γ

3 2 1 3 2 1

0 0 ... 0 0 1 0 0 0 0 ... 0 0 0

n n n

q q q q q q ⋮

− − − − − −

                                       

1 2 1 2 1 2

( ) ( )

n n n n

t t t t p r p p r p ⋮

− −

               −       =       −                       

slide-99
SLIDE 99

where we set αj, βj, γj the coefficients of qj-3, qj-2, qj-1 respectively and r1= q-2 and r2= qn-2

  • This is a tridiagonal system can be efficiently solved using a

direct method such as LU decomposition End conditions:

  • For B-Spline interpolation, the end conditions required to

Cubic B-Spline Interpolation (7)

Graphics & Visualization: Principles & Algorithms Chapter 7 99

  • For B-Spline interpolation, the end conditions required to

complete the linear system refer to the 2nd and penultimate control points q-2 , qn-2

  • Same

end condition procedures as for cubic Hermite interpolation

  • Difference:

Equations will be expressed in terms of the given points pi instead of the tangent vectors

slide-100
SLIDE 100
  • Bessel end condition:

At the start of the curve, the tangent is Equating this with: we get:

Cubic B-Spline Interpolation (8)

2 3 2 1 1

3 3 ( ) ( ) ( ) t t t t t Q q q q p

− − −

′ = − = − − −

2 1 2 1 1 2 2 1 2 1 1 2 1 2

2 ( )( ) ( )( ) ( )( ) t t t t t t t t t t t t t t t t t t t − − + − − = + + − − − − − − m p p p

  • Graphics & Visualization: Principles & Algorithms Chapter 7

100

we get: Working similar for the end of the curve we get: These expressions for q-2, qn-2 must replace r1 and r2 in the linear system

2 2 1 2 1 2 1 2 2 2 1 2 1 2

2 ( ) 1 ( ) 3 ( )( ) t t t t t t t t t t t t t t t q p p p

− − − − = − − − − − −

2 1 2 2 1 2 1 2 1 2 2 1 2

( ) 2 1 ( ) 3 ( )( )

n n n n n n n n n n n n n n n n n n n

t t t t t t t t t t t t t t t q p p p

− − − − − − − − − − − −

− − − − = − + + − − − −

slide-101
SLIDE 101
  • Quadratic end condition:

We may write the first (and similarly the last) segment of B-Spline curve, defined over a parametric interval [t0, t1], as a cubic Bézier curve and differentiate this form twice:

Cubic B-Spline Interpolation (9)

2 2 1 1 1 2 3 2 1 1

( ) 3( ) ( ) 3( )

n n n n n n n n

t t t t t t t t q q p p q q p p

− − − − − − −

− − = − − − − = − −

Graphics & Visualization: Principles & Algorithms Chapter 7 101

The above must replace the 2nd and the penultimate equation of the system, in full The system remains tridiagonal after the changes

  • Physical end conditions:

Applied similarly and the respective equations are:

2 1 2 1 1 2 1 3 1 2 2 2

( 2 ) ( ) ( ) ( ) (2 ) ( )

n n n n n n n n n n

t t t t t t t t t t t t t t

− − − − − − − −

+ − − − = − − − − − = − − q q p q q p

1

3( )

n n

t t − −

slide-102
SLIDE 102
  • The user is interested only in providing the points that the curve

interpolates

  • In such cases, required knots may be computed algorithmically

We can use the given points to generate better shaped curves

  • Parameterization methods presented for B-Spline curves, can be

applied here as well

  • Uniform parameterization is the simplest

Parameterizations of Piecewise Interpolation Curves

Graphics & Visualization: Principles & Algorithms Chapter 7 102

In Uniform the knots are equidistant

  • Uniform is used in practice, although other methods may

produce better curves:

Simplifies the linear systems that must be solved to produce C2 cubic interpolating curves

  • More complex parameterizations (to achieve smoother curves),

can be constructed by using the given interpolated points pi

slide-103
SLIDE 103
  • A chord-length parameterization can be computed from:
  • A centripetal parameterization can be computed from:

Parameterizations of Piecewise Interpolation Curves (2)

2 1 2 1 1 1 i i i i i i i i

t t t t

+ + + + + +

− − = − − p p p p

2 1 2 1 1 1 i i i i i i i i

t t t t

+ + + + + +

− − = − − p p p p

Graphics & Visualization: Principles & Algorithms Chapter 7 103

  • In both above cases, the value of initial knot t0 can be specified

arbitrarily

  • Notice:

B-Spline parameterizations use the control points of the curve

But:

Parameterizations of interpolating curves use the points being interpolated the shape of the curve should be adopted to them

1 1 i i i i

t t

+ +

− − p p

slide-104
SLIDE 104
  • Bézier and B-spline curves can be used to generate parametric

surfaces

  • Most straightforward types:
  • Tensor product Bézier surfaces

Surfaces

Graphics & Visualization: Principles & Algorithms Chapter 7

  • Tensor product B-spline surfaces
  • Are simple generalizations of the respective curves
  • Inherit most of their properties

104

slide-105
SLIDE 105
  • Consider a Bézier curve of degree m with control points pi,

i=0,1,…,m given in terms of parameter u: (1)

  • Each control point pi traces a Bézier curve of degree n with control

points pi,j , j=0,1,…,n in terms of parameter v: (2)

Every point of the initial curve will trace a Bézier curve of degree n.

Tensor Product Bézier Surfaces

( ) ( ) , [0,1]

m m m i i i

u B u u

=

= ∈

P p

,

( ) ( ) , [0,1]

n n n i j i j j

v B v v

=

= ∈

P p

Graphics & Visualization: Principles & Algorithms Chapter 7

  • Every point of the initial curve will trace a Bézier curve of degree n.
  • All these curves will generate a tensor product Bézier surface
  • Replace the points pi in (1) with the curve that the surface traces
  • The equation of a surface of degree m in u and degree n in

v is: (3)

105

( )

n i v

P

, ( , ) m n u v

P

, , ,

( , ) ( ) ( ) ( ) ( ) , [0,1], [0,1]

m n m m n m n m n n i j j i j i j i j i j i

u v B u B v B u B v u v

= = = =

      = = ∈ ∈        

∑ ∑ ∑∑

P p p

slide-106
SLIDE 106
  • Control points (or control net): the (m+1)×(n+1) control points that

are used for the definition of the surface

  • They can be shown in a rectangular arrangement:

(T)

Tensor Product Bézier Surfaces (2)

Graphics & Visualization: Principles & Algorithms Chapter 7

  • Boundary curves of the Bézier surface: the isoparametric curves that

correspond to u=0, u=1, v=0 and v=1

  • The construction is symmetric: the same surface is constructed by

starting with any of the boundary curves

106

slide-107
SLIDE 107
  • To compute a point of a Bézier surface:
  • Apply the de Casteljau algorithm to each of the rows of (T) for v
  • (m+1) points are computed which are the control points of the

isoparametric curve corresponding to v

  • Apply again the de Casteljau algorithm to these points for u

The de Casteljau algorithm

, ( , ) m n u v

P

Graphics & Visualization: Principles & Algorithms Chapter 7

  • The resulting point is

107

, ( , ) m n u v

P

slide-108
SLIDE 108

The de Casteljau algorithm for tensor product Bézier surfaces:

point bezierSurfacePoint ( int m, int n, point[][] controlPt, float u, float v ) { point tmpPt[n+1]; point curvePt[n+1]; for (i=0; i <= m; i++) {

The de Casteljau algorithm (2)

Graphics & Visualization: Principles & Algorithms Chapter 7

for (i=0; i <= m; i++) { for (j=0; j <= n; j++) { tempPt[j] = controlPt[i][j]; } curvePt[i] = bezierPoint(n, tempPt, v); } return bezierPoint(m, curvePt, u); }

108

slide-109
SLIDE 109
  • These properties are generalizations of the properties of Bézier curves:
  • Bézier surfaces have:
  • Convex-hull property
  • Invariance under affine transformations
  • Invariance under affine transformations of their parameter
  • Symmetry with respect to their control points
  • Planar precision

Tensor Product Bézier Surfaces:Properties

Graphics & Visualization: Principles & Algorithms Chapter 7

Planar precision

  • Boundary control points interpolation
  • Pseudo-local control
  • Surfaces don’t have the variation-diminishing property
  • The partial derivatives are the tangents of isoparametric curves of the

surface

  • The partial derivatives with respect to u are:

109

, ,

( , ) ( ) ( )

n m m n n m j i i j j i

u v B v B u u u

= =

  ∂ ∂   =      ∂ ∂  

∑ ∑

P p

slide-110
SLIDE 110
  • Generalization of Bézier curve subdivision
  • A pair of values (u0, v0) is chosen and the surface is subdivided into 4

sub-surfaces of the same type

  • The control points of the sub-surfaces are produced using the de

Casteljau algorithm:

  • Apply the de Casteljau algorithm to every line of (T)
  • Each of the curves is subdivided into a “left” and a “right” segment

Bézier surface subdivision

Graphics & Visualization: Principles & Algorithms Chapter 7

  • Each of the curves is subdivided into a “left” and a “right” segment
  • 2 sets of (m+1) × (n+1) control points are created
  • Apply de Casteljau to the 2 × (m+1) × (n+1) columns of control points
  • Each segment is subdivided into a “top” and “bottom” segment
  • 4 sets of (m+1) × (n+1) control points result, defining the 4 subsurfaces

110

slide-111
SLIDE 111
  • Applications:
  • Drawing a Bézier surface:

if the control points are coplanar draw the polygon defined by the 4 extreme control points else subdivide the surface into 4 subsurfaces for an arbitrary pair (u , v )

Bézier surface subdivision (2)

Graphics & Visualization: Principles & Algorithms Chapter 7

pair (u0, v0) perform the same procedure recursively to each of the subsurfaces

  • Finding intersections between a Bézier surface and a line or plane

111

slide-112
SLIDE 112
  • Is a smooth surface constructed by joining together low-degree

surfaces with suitable continuity constraints

  • Is constructed by parametric surfaces of:
  • Degree k with respect to u
  • Degree l with respect to v

joined with continuity:

  • Ck-1 with respect to u

Tensor Product B-Spline Surfaces

Graphics & Visualization: Principles & Algorithms Chapter 7

  • Ck-1 with respect to u
  • Cl-1 with respect to v
  • Has a set of (m+1)×(n+1) control points pi,j
  • m and n are independent of the degrees k and l of the surface
  • Has 2 sets of knots:
  • u1, u2, …, um+k for u
  • v1, v2, …, vn+l for v

112

slide-113
SLIDE 113
  • Is given by :
  • The domain of the surface is [uk, um+1]×[vl, vn+1]
  • Arrangement that depicts the control elements of a B-spline surface:

Tensor Product B-Spline Surfaces (2)

,

( , ) ( ) ( )

m n k i j i j i j

u v N u N v

= =

=∑∑ Q p

Graphics & Visualization: Principles & Algorithms Chapter 7

  • Arrangement that depicts the control elements of a B-spline surface:

113

slide-114
SLIDE 114
  • Compute a point Q(u, v) on a tensor product B-spline surface:
  • Find the interval [ui, ui+1] × [vj, vj+1] into which (u, v) belongs
  • Apply the de Boor algorithm to each of the rows of the control net for the value

v [vj, vj+1]

  • This produces (m+1) points
  • Apply the de Boor algorithm to each of the (m+1) points for u

[ui, ui+1]

  • The procedure can be carried out first for u (columns of the control

The de Boor Algorithm

∈ ∈

Graphics & Visualization: Principles & Algorithms Chapter 7

  • The procedure can be carried out first for u (columns of the control

net) and then for v without changing the result.

114

slide-115
SLIDE 115
  • The 2 knot sequences, for u and v maintain all the properties of the

knot sequence of a B-spline curve

  • It is difficult to find automatically knot sequences
  • Knot insertion is not difficult & uses the Boehm algorithm
  • A knot may be inserted independently in any of the 2 knot sequences
  • If a knot is inserted in u1, u2, …, um+k

apply the Boehm algorithm to the columns of the control net

Knots and Parameterizations

Graphics & Visualization: Principles & Algorithms Chapter 7

apply the Boehm algorithm to the columns of the control net

a full row of control points is added to the control net

  • Similarly if a knot is inserted in v1, v2, …, vn+l

apply the Boehm algorithm to the rows of the control net

a full column of control points is added to the control net

115

slide-116
SLIDE 116
  • Are generalizations of properties of B-spline curves
  • Tensor Product B-spline Surfaces have:
  • Local control
  • Strong convex-hull property
  • Invariance under affine transformations
  • Invariance under affine transformations of their parameters
  • Planar precision

Properties

Graphics & Visualization: Principles & Algorithms Chapter 7

  • Planar precision
  • Boundary control points interpolation if the extreme knots have suitable

multiplicity

  • They don’t have the variation-diminishing property

116

slide-117
SLIDE 117
  • Bi-cubic tensor product B-spline surfaces Q(u, v) : surfaces of degree

3 for both u and v

  • Given
  • (m+1)×(n+1) points pi,j , i=0,1,…,m and j=0,1,…,n
  • Two knot sequences ui, i=0,1,…,m and vj, j=0,1,…,n

determine the (m+3)×(n+3) control points qi,j of Q(u, v) that satisfy:

  • Computation :

Interpolation

,

( , ) , 0,1, , and 0,1,...,

i j i j

u v i m j n = = … = Q p

Graphics & Visualization: Principles & Algorithms Chapter 7

  • Computation :
  • Interpolate each column of the array of points pi,j in terms of u

Compute the control points si,j of the respective interpolation curves

Each of the curves has (m+3) control points and requires also r0,j and r1,j , j=0,1,…,n

  • Interpolate each row of si,j in terms of v

Compute the control points qi,j

Each of the (m+3) curves has (n+3) control points and requires ci,0 and ci,1

117