Curves & Surfaces - Departamento de...

50
Dpto. de Informática Fac. Cs. Físico-Mat. y Nat. Universidad Nacional De San Luis Argentina Curves & Surfaces Curves & Surfaces

Transcript of Curves & Surfaces - Departamento de...

Page 1: Curves & Surfaces - Departamento de Informáticadirinfo.unsl.edu.ar/.../abm/...curves-surfaces_15.pdf · Curves & Surfaces • Polylines and polygons are piecewise linear approximations

Dpto. de InformáticaFac. Cs. Físico-Mat. y Nat.

Universidad Nacional De San LuisArgentina

Curves & SurfacesCurves & Surfaces

Page 2: Curves & Surfaces - Departamento de Informáticadirinfo.unsl.edu.ar/.../abm/...curves-surfaces_15.pdf · Curves & Surfaces • Polylines and polygons are piecewise linear approximations

Dpto. de Informática 2 - Roberto Guerrero @ 2015

Curves & SurfacesCurves & Surfaces

- Smooth representation

- Mathematical curve representation

- Parametric Polinomial curves

- Interactive curve design- Curve characterization- Hermite curve- Continuity- De Casteljau Algorithm- Bezier curves

- Bezier curves properties- Local control- Blending functions

- Piecewise polinomial curve- Set of piecewise curves

- Splines curves & Basis functions- Bsplines- NURBS- Curves Surfaces

Page 3: Curves & Surfaces - Departamento de Informáticadirinfo.unsl.edu.ar/.../abm/...curves-surfaces_15.pdf · Curves & Surfaces • Polylines and polygons are piecewise linear approximations

Dpto. de Informática 3 - Roberto Guerrero @ 2015

Curves & SurfacesCurves & Surfaces

Smooth RepresentationsMotivation

• Where do we need smooth curves & surfaces? – In modeling objects.– Stating the path of a camera or object in an animation sequence (trajectory and velocity).– Filtering and reconstruction for images.

Page 4: Curves & Surfaces - Departamento de Informáticadirinfo.unsl.edu.ar/.../abm/...curves-surfaces_15.pdf · Curves & Surfaces • Polylines and polygons are piecewise linear approximations

Dpto. de Informática 4 - Roberto Guerrero @ 2015

Curves & SurfacesCurves & Surfaces

Smooth RepresentationsModeling

• Modeling real objects: add more detail to model– Real objects are inherently smooth.– We can use infinitely many points of the object, but this is not feasible for a computer with finite

storage.– We can approximate the object with pieces of planes, spheres or other shapes that are easy to

describe mathematically.

• Modeling from “scratch”: (non preexisting physical objects)– High-quality character fonts and artists´ sketches, all contains smooth curves

and surfaces. – The user creates the “free form”objects in the modeling process.– The user can sculpt the object or just give an approximate description

that later must be “filled in”.– The modeling is much easier if the object is described mathematically.

Page 5: Curves & Surfaces - Departamento de Informáticadirinfo.unsl.edu.ar/.../abm/...curves-surfaces_15.pdf · Curves & Surfaces • Polylines and polygons are piecewise linear approximations

Dpto. de Informática 5 - Roberto Guerrero @ 2015

Curves & SurfacesCurves & Surfaces

• A general approach is to use functions of high degree that represent directly the coordinates of a curve.

Functions can be expressed by means of three methods:

• Explicit Functions: one variable is dependent of the other/s.

– Not general.– Cannot get multiples values of y from a single x (circles and ellipses).– Not rotationally invariant.– Difficult represent curves with infinite slope (derivative > 1).

• Implicit Equations:

– Dangerous.– The equation may have more solutions than we want. (how represent a half circle?).– Allows easy categorization of points (belonging or not to the curve) and rapid determination of

normals.

Mathematical Curve Representation

y= f ( x ) z= f ( x , y )

g ( x , y )=0 g ( x , y , z )=0

Page 6: Curves & Surfaces - Departamento de Informáticadirinfo.unsl.edu.ar/.../abm/...curves-surfaces_15.pdf · Curves & Surfaces • Polylines and polygons are piecewise linear approximations

Dpto. de Informática 6 - Roberto Guerrero @ 2015

Curves & SurfacesCurves & Surfaces

• Parametric Representation: express a curve describing the coordinates by means of equations of the same parameter.

– Overcomes problems caused by functional or implicit forms.– Replace the use of geometric slopes with parametric

tangent vectors.

Mathematical Curve Representation

Epicycloid Hypocycloid

S (u ,v )=( x (u , v) , y (u , v) , z(u , v ))

Page 7: Curves & Surfaces - Departamento de Informáticadirinfo.unsl.edu.ar/.../abm/...curves-surfaces_15.pdf · Curves & Surfaces • Polylines and polygons are piecewise linear approximations

Dpto. de Informática 7 - Roberto Guerrero @ 2015

Curves & SurfacesCurves & Surfaces

• Polylines and polygons are piecewise linear approximations to curves and surfaces, respectively.

• A general approach is to use functions of higher degree that represent directly the coordinates of the object´s structure.

• The idea: use parametric curves, Q(u)=(x(u),y(u)), where the functions are all polynomials in the parameter u.

• Advantages:– Easy (and efficient) to compute.– Infinitely differentiable.– Assume that u varies from 0 to 1.

• Finally, approximate object curves and surfaces by piecewise polynomial curves. That is, an

overall curve is a collection of parametric polynomial curves.

Parametric Polynomial Curves

Page 8: Curves & Surfaces - Departamento de Informáticadirinfo.unsl.edu.ar/.../abm/...curves-surfaces_15.pdf · Curves & Surfaces • Polylines and polygons are piecewise linear approximations

Dpto. de Informática 8 - Roberto Guerrero @ 2015

Curves & SurfacesCurves & Surfaces

• An L-th degree polynomial in t is:

where:– the constants are the coefficients.– the degree is the highest power to which t is raised (with < > 0).– the order is the number of coefficient (L + 1).

• Polynomial Curves of Degree 1linear polynomial for the parametric forms for x(t) and y(t) yields a straight line.

• Polynomial Curves of Degree 2what shapes are attainable by using quadratic polynomials?

– Unfortunately, the curve is always a parabola, for any choice of the coefficients. There is no way to generate an ellipse or hyperbola.

Describing Curves by means of Polynomials

Page 9: Curves & Surfaces - Departamento de Informáticadirinfo.unsl.edu.ar/.../abm/...curves-surfaces_15.pdf · Curves & Surfaces • Polylines and polygons are piecewise linear approximations

Dpto. de Informática 9 - Roberto Guerrero @ 2015

Curves & SurfacesCurves & Surfaces

• From the analytic geometry, the general second-degree implicit form generates a conic section from the family of conics.

• Polynomial Curves of degree Three and Higher– things get more complicated when the polynomials are of higher degree: require more

computations, need to consider a lot of conditions.

• Sederberg has shown that:– always is possible to find an implicit form given polynomial functions

for x(t) and y(t).– a parametric form can in general be found, given an implicit form

that is of degree one or two.

• Rational polynomial functions can represent conic sections by exactly a ratio of two quadratic polynomials for x(t) and y(t).

Describing Curves by means of Polynomials

F ( x , y)= Ax2+2 Bxy+Cy2+ Dx+Ey+F

Page 10: Curves & Surfaces - Departamento de Informáticadirinfo.unsl.edu.ar/.../abm/...curves-surfaces_15.pdf · Curves & Surfaces • Polylines and polygons are piecewise linear approximations

Dpto. de Informática 10 - Roberto Guerrero @ 2015

Curves & SurfacesCurves & Surfaces

• Generally, would be expected that methods start with an implicit form and try to parameterize it (mathematical approach).

• Actually, a more natural approach to curve design will start with a collection of “control points” laid down by the designer, allowing a specific algorithm to generate points along the curve, and accept the curve regardless of the implicit function it satisfies.

Interactive Curve Design

Page 11: Curves & Surfaces - Departamento de Informáticadirinfo.unsl.edu.ar/.../abm/...curves-surfaces_15.pdf · Curves & Surfaces • Polylines and polygons are piecewise linear approximations

Dpto. de Informática 11 - Roberto Guerrero @ 2015

Curves & SurfacesCurves & Surfaces

Two main classes of curve-generation algorithms:

• Algorithms that interpolates the control points:– The algorithm returns points along a curve P(t) that passes exactly through the control

point at specific instants.

• Algorithms that approximates the control points:– The algorithm returns points that form a curve R(t) that is attracted towards each control

point in turn, but the curve actually doesn't pass through all of them.

Interactive Curve Design

Page 12: Curves & Surfaces - Departamento de Informáticadirinfo.unsl.edu.ar/.../abm/...curves-surfaces_15.pdf · Curves & Surfaces • Polylines and polygons are piecewise linear approximations

Dpto. de Informática 12 - Roberto Guerrero @ 2015

Curves & SurfacesCurves & Surfaces

Two aspects characterize a curve:

• Trajectory: is the shape (path) described by the parameter t as it takes different values on x(t) and y(t).

Curve Characterization

Page 13: Curves & Surfaces - Departamento de Informáticadirinfo.unsl.edu.ar/.../abm/...curves-surfaces_15.pdf · Curves & Surfaces • Polylines and polygons are piecewise linear approximations

Dpto. de Informática 13 - Roberto Guerrero @ 2015

Curves & SurfacesCurves & Surfaces

• Velocity: is a vector v(t) that describes the speed and direction of a point along the curve P(t).

• The vector v(t) can be used to represent the tangent line to the curve P(t) at a given point t = t0. Parametrically:

• The normal direction to the curve at a point is defined as the direction perpendicular to the tangent line at this point.

Curve Characterization

v (t )=∂ P (t )

∂ t=[ ∂ x (t )

∂ t,∂ y (t )

∂ t ]

n(t 0)=v .⊥ . (t0)=[−∂ y∂ t

, ∂ x∂ t ]

t =t0

L (u)=P (t0 )+v (t 0)u

Page 14: Curves & Surfaces - Departamento de Informáticadirinfo.unsl.edu.ar/.../abm/...curves-surfaces_15.pdf · Curves & Surfaces • Polylines and polygons are piecewise linear approximations

Dpto. de Informática 14 - Roberto Guerrero @ 2015

Curves & SurfacesCurves & Surfaces

• Generates a cubic polynomial curve segment from a set of four values, P1, P2, P3, P4. • P1 and P4 are the endpoints and P2, P3 (R1, R4,) are the tangent vectors at the endpoints.

Where:

• The curve must interpolate the endpoints. Which are the coefficients a, b, c, d ??

Hermite Curve

y(t) = ay t3 + by t2 + cy t + dy

Q(t) = a t3 + b t2 + c t + d with t on the interval [0,1]

x(t) = ax t3 + bx t2 + cx t + dx

(P2)

(P3)

Page 15: Curves & Surfaces - Departamento de Informáticadirinfo.unsl.edu.ar/.../abm/...curves-surfaces_15.pdf · Curves & Surfaces • Polylines and polygons are piecewise linear approximations

Dpto. de Informática 15 - Roberto Guerrero @ 2015

Curves & SurfacesCurves & Surfaces

• Calculating the derivative of Q(t)

• And considering that the curve must interpolate the endpoints, for the two coordinates x(t) and y(t) have to be:

Hermite Curve

Q´(t) = 3a t2 + 2b t + cwith t on the interval [0,1]

Page 16: Curves & Surfaces - Departamento de Informáticadirinfo.unsl.edu.ar/.../abm/...curves-surfaces_15.pdf · Curves & Surfaces • Polylines and polygons are piecewise linear approximations

Dpto. de Informática 16 - Roberto Guerrero @ 2015

Curves & SurfacesCurves & Surfaces

• Calculating the derivative of Q(t) and Q´(t) at t = 0 and t = 1.

• Solving in Q(t) we have four polynomials weighting each element of the geometry vector:

Hermite Curve

Q(0) = h0 = d

Q(1) = h1 = a + b + c + d

Q´(0) = h2 = c

Q´(1) = h3 = 3a + 2b + c

a = 2h0 - 2h1

+ h2 + h3

b = -3h0 + 3h1

- 2h2 - h3

c = h2

d = h0

Blending Functions

Q(t) = (2t3 + 3t2 + 1)P1 + (-2t3 + 3t2)P4 + (t3 - 2t2 + t)R1 + (t3 - t2)R4

Q(t) = a t3 + b t2 + c t + d Q´(t) = 3a t2 + 2b t + c

Page 17: Curves & Surfaces - Departamento de Informáticadirinfo.unsl.edu.ar/.../abm/...curves-surfaces_15.pdf · Curves & Surfaces • Polylines and polygons are piecewise linear approximations

Dpto. de Informática 17 - Roberto Guerrero @ 2015

Curves & SurfacesCurves & Surfaces

• We want to approximate curves by piecewise polynomial segments.• We want our curve to have continuity. • There shouldn’t be an abrupt change when we move from one segment to the next.

Continuity

Parametric Continuity

Page 18: Curves & Surfaces - Departamento de Informáticadirinfo.unsl.edu.ar/.../abm/...curves-surfaces_15.pdf · Curves & Surfaces • Polylines and polygons are piecewise linear approximations

Dpto. de Informática 18 - Roberto Guerrero @ 2015

Curves & SurfacesCurves & Surfaces

• Parametric Continuity Ck

A curve P(t) has kth-order parametric continuity in the t-interval [a,b] if all derivatives of the curve, up through the kth, exist and are continuous at all point inside [a,b].

• Geometric Continuity Gk

– It is more relaxed than parametric continuity.– Describes the visual smoothness of a curve than the smoothness of motion along the

curve.– Requires the derivative vector have a continuous direction, doesn't matter the speed.

Continuity

Different directions and velocities

Page 19: Curves & Surfaces - Departamento de Informáticadirinfo.unsl.edu.ar/.../abm/...curves-surfaces_15.pdf · Curves & Surfaces • Polylines and polygons are piecewise linear approximations

Dpto. de Informática 19 - Roberto Guerrero @ 2015

Curves & SurfacesCurves & Surfaces

Continuity

Page 20: Curves & Surfaces - Departamento de Informáticadirinfo.unsl.edu.ar/.../abm/...curves-surfaces_15.pdf · Curves & Surfaces • Polylines and polygons are piecewise linear approximations

Dpto. de Informática 20 - Roberto Guerrero @ 2015

Curves & SurfacesCurves & Surfaces

• Generates a curve from a set of point. • A sequence of points P0, P1, P2,…. is used to construct a well-defined value for the

point P(t) at each value of t from 0 to 1.• Changing the points, changes the curve.

Creating a Parabola from three points:– suppose three points P0, P1, P2

– choose a value t between 0 and 1, t = 0.3– locate A, a fraction t of the way along the line from P0 to P1

– locate B, a fraction t of the way along the line from P1 to P2

– locate P(t), a fraction t of the way along the line from A and B

De Casteljau Algorithm

A(t) = (1 - t) P0 + tP1

B(t) = (1 - t) P1 + tP2

P(t) = (1 - t) A + tB

P(t) = (1 - t) A + tB

Page 21: Curves & Surfaces - Departamento de Informáticadirinfo.unsl.edu.ar/.../abm/...curves-surfaces_15.pdf · Curves & Surfaces • Polylines and polygons are piecewise linear approximations

Dpto. de Informática 21 - Roberto Guerrero @ 2015

Curves & SurfacesCurves & Surfaces

• The parametric form

• Property– The curve passes through P0, at t = 0 and P2 at t = 1.

De Casteljau Algorithm

P t = 1− t 2P 0 2 1− t t P 1 t 2 P 2

P(t) = (1 - t) A + tB

Page 22: Curves & Surfaces - Departamento de Informáticadirinfo.unsl.edu.ar/.../abm/...curves-surfaces_15.pdf · Curves & Surfaces • Polylines and polygons are piecewise linear approximations

Dpto. de Informática 22 - Roberto Guerrero @ 2015

Curves & SurfacesCurves & Surfaces

Creating a Curve from four points: indirectly specify the tangent vectors of Hermite by specifying two intermediate points.

(parametric form)

De Casteljau Algorithm

P ( t) = (1− t )3P 0 + 3(1− t)2 t P 1 + 3(1− t ) t 2P 2 + t 3 P3

Page 23: Curves & Surfaces - Departamento de Informáticadirinfo.unsl.edu.ar/.../abm/...curves-surfaces_15.pdf · Curves & Surfaces • Polylines and polygons are piecewise linear approximations

Dpto. de Informática 23 - Roberto Guerrero @ 2015

Curves & SurfacesCurves & Surfaces

Bernstein Polynomials:– are the set of functions associated with the control points.

• Useful properties on the interval [0,1]– each is between 0 and 1.– sum of all four is exactly 1.

Blending Functions

De Casteljau Algorithm

∑k=0

3

Bk3 t =1

∑ x

B03=1−t 3

B13=31−t 2 t

B23=31−t t2

B33=t3

P t = 1− t 3P 0 3 1− t 2 t P 1 3 1− t t 2 P 2 t 3P 3

Page 24: Curves & Surfaces - Departamento de Informáticadirinfo.unsl.edu.ar/.../abm/...curves-surfaces_15.pdf · Curves & Surfaces • Polylines and polygons are piecewise linear approximations

Dpto. de Informática 24 - Roberto Guerrero @ 2015

Curves & SurfacesCurves & Surfaces

Extending Bernstein Polynomials to any number of points:

• Suppose n + 1 control points P0, P1, P2,…., Pn

• The resulting curve P(t) can be written:

with

Bezier Curves

P (t )=∑i=0

n

Bin(t) Pi

Bin(t )=(n

i )(1−t )n−i t i

∑i=0

n

Bint =1

P t = 1− t 3P 0 3 1− t 2 t P 1 3 1− t t 2 P 2 t 3P 3

Page 25: Curves & Surfaces - Departamento de Informáticadirinfo.unsl.edu.ar/.../abm/...curves-surfaces_15.pdf · Curves & Surfaces • Polylines and polygons are piecewise linear approximations

Dpto. de Informática 25 - Roberto Guerrero @ 2015

Curves & SurfacesCurves & Surfaces

• Endpoint Interpolation: always interpolates the first and last control points, that is, the curve always will begin and end. The intermediate points are approximated.

• Affine Invariance: means that no matters the affine transformations applied to the control points, the resulting curve is identical to the curve based on the untransformed control points.

Invariance under affine transf. of the parameter: (use a different interval [0,1])• Suppose a parameter u in the interval [a, b].

Replace t for:

Bezier Curves Properties

u - ab - a

t =

Page 26: Curves & Surfaces - Departamento de Informáticadirinfo.unsl.edu.ar/.../abm/...curves-surfaces_15.pdf · Curves & Surfaces • Polylines and polygons are piecewise linear approximations

Dpto. de Informática 26 - Roberto Guerrero @ 2015

Curves & SurfacesCurves & Surfaces

• Convex-hull: the curve never wanders outside the convex hull of the control points.

• Linear Precision: the convex hull property shows that if the control points are placed in a straight line, the resulting curve is “trapped” inside the hull and so is a straight line.

• Variation-diminishing: the Bezier curve cannot “fluctuate” more than their control polygon does.

Bezier Curves Properties

Page 27: Curves & Surfaces - Departamento de Informáticadirinfo.unsl.edu.ar/.../abm/...curves-surfaces_15.pdf · Curves & Surfaces • Polylines and polygons are piecewise linear approximations

Dpto. de Informática 27 - Roberto Guerrero @ 2015

Curves & SurfacesCurves & Surfaces

• Bezier curves do not offer local control over the shape of the curve.• The resulting curve is a blend of different functions.• Every Bernstein polynomial has support over the entire interval [0,1], that is why any change

on the polynomial affects the others. • A change to any control point alters

the entire curve.

Local Control

Page 28: Curves & Surfaces - Departamento de Informáticadirinfo.unsl.edu.ar/.../abm/...curves-surfaces_15.pdf · Curves & Surfaces • Polylines and polygons are piecewise linear approximations

Dpto. de Informática 28 - Roberto Guerrero @ 2015

Curves & SurfacesCurves & Surfaces

Whish List of properties that must be accomplished

1. Be easy to compute and stable: choose polynomial with low degree.2. The functions must sum to unity at every interval [a,b].3. Functions must have support over a small portion of the interval (local control).4. Functions must interpolate certain control points.5. Functions should have sufficient smoothness: the resulting curve must “start” and “stop”

gracefully.

Blending Functions

Page 29: Curves & Surfaces - Departamento de Informáticadirinfo.unsl.edu.ar/.../abm/...curves-surfaces_15.pdf · Curves & Surfaces • Polylines and polygons are piecewise linear approximations

Dpto. de Informática 29 - Roberto Guerrero @ 2015

Curves & SurfacesCurves & Surfaces

• No exist a cubic polynomial that satisfies all the properties.

Piecewise Polynomial Curves

• Generate one by piecing together several low-degree polynomials.

– Every segment has a degree of 2.– The support for every polynomial is called span– the values of t where the individual segments meet are called

knots

• The piecewise generated function is an Spline Function.

Page 30: Curves & Surfaces - Departamento de Informáticadirinfo.unsl.edu.ar/.../abm/...curves-surfaces_15.pdf · Curves & Surfaces • Polylines and polygons are piecewise linear approximations

Dpto. de Informática 30 - Roberto Guerrero @ 2015

Curves & SurfacesCurves & Surfaces

• How to use a set of spline functions as blending functions representing a curve?

Using a shifted version as a basic spline, say gk(t)

Set of Piecewise Curves

V (t )=∑k=0

6

g (t−k )P k for t∈[2,7]

with g k (t )=g (t−k ) for k=0,1 , ...

• Parametrically the curve will be

Page 31: Curves & Surfaces - Departamento de Informáticadirinfo.unsl.edu.ar/.../abm/...curves-surfaces_15.pdf · Curves & Surfaces • Polylines and polygons are piecewise linear approximations

Dpto. de Informática 31 - Roberto Guerrero @ 2015

Curves & SurfacesCurves & Surfaces

• Example:

• Properties– The designer has local control

limited to length 3.– Intuitive geometric properties.

The curve pass through midpoints of the edges.– No points on the curve are interpolated.– All polynomials are of degree two.

Set of Piecewise Curves

Page 32: Curves & Surfaces - Departamento de Informáticadirinfo.unsl.edu.ar/.../abm/...curves-surfaces_15.pdf · Curves & Surfaces • Polylines and polygons are piecewise linear approximations

Dpto. de Informática 32 - Roberto Guerrero @ 2015

Curves & SurfacesCurves & Surfaces

• Bezier and g(t) seem to fit into a more general scheme.– Bezier: there is one span from 0 - 1. The Bernstein polynomials are of degree L.

There are L + 1 knots at t= 0 and t= 1. They have continous derivatives.– Translates of g(t): The knots values are the integers 0,1, 2 ... L+2 and each translated

g(t - k) is a spline consisting of three polynomial of degree 2 and covering a span of 3.

• We seek a more general family of blending functions that meet al the properties discussed in the wish list.

Spline Curves & Basis Functions

T = (t0, t1 , t2, ....) the knot vectorP (t)=∑

k =0

L

Rk (t )P k

L +1 control points

Page 33: Curves & Surfaces - Departamento de Informáticadirinfo.unsl.edu.ar/.../abm/...curves-surfaces_15.pdf · Curves & Surfaces • Polylines and polygons are piecewise linear approximations

Dpto. de Informática 33 - Roberto Guerrero @ 2015

Curves & SurfacesCurves & Surfaces

• Given a knot vector, is there some family of blending functions that can be used to generate every possible spline curve based on that knot vector?

– It must use a control polygon.– It must have the smallest support.– It must have local control.

• Lets define:

with:• (L + 1) control points Pk

• a knot vector T = (t0, t1 , t2, ....)• m is the order of the B-spline function.

B-Spline Basis Functions

N (t) =k,m

t - tk

tk+m-1 - tk

N (t) +k,m -1

N (t)k +1,m -1

tk+m - t

tk+m - tk+1

N (t) =k, 1

1 if tk < t <= tk+1

0 otherwise

P (t)=∑k =0

L

N k , m(t) P k

Page 34: Curves & Surfaces - Departamento de Informáticadirinfo.unsl.edu.ar/.../abm/...curves-surfaces_15.pdf · Curves & Surfaces • Polylines and polygons are piecewise linear approximations

Dpto. de Informática 34 - Roberto Guerrero @ 2015

Curves & SurfacesCurves & Surfaces

• Examples

B-Spline Basis Functions

12

t 2 for 0≤t≤1

34−t−

32

2

for 1≤t≤2

123−t 2 for 0≤t≤1

N 0,3 t

Page 35: Curves & Surfaces - Departamento de Informáticadirinfo.unsl.edu.ar/.../abm/...curves-surfaces_15.pdf · Curves & Surfaces • Polylines and polygons are piecewise linear approximations

Dpto. de Informática 35 - Roberto Guerrero @ 2015

Curves & SurfacesCurves & Surfaces

• When all the knots at the knot vector are equispaced, the curve is called Uniform B-Spline.

• What happens to the shape of the curve when varying the spacing between knots?• The designer acquires much greater control on the shape of the final curve.• What happens to the blending functions when two knots are set very close to one another?

The blending functions are not equispaced translations.• What happens if there exist multiplicity of a knot?

B-Splines

T = (0,1,2,3,4,5,6,7,8,9)

Page 36: Curves & Surfaces - Departamento de Informáticadirinfo.unsl.edu.ar/.../abm/...curves-surfaces_15.pdf · Curves & Surfaces • Polylines and polygons are piecewise linear approximations

Dpto. de Informática 36 - Roberto Guerrero @ 2015

Curves & SurfacesCurves & Surfaces

• B-spline shapes with multiplicity 2 of the knot 3.

B-Splines

Page 37: Curves & Surfaces - Departamento de Informáticadirinfo.unsl.edu.ar/.../abm/...curves-surfaces_15.pdf · Curves & Surfaces • Polylines and polygons are piecewise linear approximations

Dpto. de Informática 37 - Roberto Guerrero @ 2015

Curves & SurfacesCurves & Surfaces

• We need the curve interpolates the first and last control points. Use multiplicity of knots.• Standard knot vector: for a B-spline of order m begins and ends with a knot vector of

multiplicity m and uses unit spacing for the remaining knots. The curve is called Open-uniform B-Spline.

• Suppose L+1 = 8 control points, want to generate a cubic spline (m = 4). The knot vector will have 12 values.

T = (0,0,0,0, 1,2,3,4, 5,5,5,5)

B-Splines

N 7,4 t

Page 38: Curves & Surfaces - Departamento de Informáticadirinfo.unsl.edu.ar/.../abm/...curves-surfaces_15.pdf · Curves & Surfaces • Polylines and polygons are piecewise linear approximations

Dpto. de Informática 38 - Roberto Guerrero @ 2015

Curves & SurfacesCurves & Surfaces

Ruled Surface based on B-Splines• Two end curves P0(u) and P1(u) that are conected by a straight line at each value of u.

• Now the curves are represented by a B-spline curve.

Curved Surfaces

P u , v =1−v P 0uvP1u

P (u , v)=∑k=0

3

Bk3(u )((1−v) Pk

0+vP k

1)

Page 39: Curves & Surfaces - Departamento de Informáticadirinfo.unsl.edu.ar/.../abm/...curves-surfaces_15.pdf · Curves & Surfaces • Polylines and polygons are piecewise linear approximations

Dpto. de Informática 39 - Roberto Guerrero @ 2015

Curves & SurfacesCurves & Surfaces

T = (0,0,0,2,2,3,3,3)

B-Splines

• The resulting curve

• When the values at the knot vector are unequispaced and/or with multiplicity, the curve is called Non-Uniform B-Spline.

Page 40: Curves & Surfaces - Departamento de Informáticadirinfo.unsl.edu.ar/.../abm/...curves-surfaces_15.pdf · Curves & Surfaces • Polylines and polygons are piecewise linear approximations

Dpto. de Informática 40 - Roberto Guerrero @ 2015

Curves & SurfacesCurves & Surfaces

Multiple control points• The designer can alter the shape of the curve by placing several control point at the same

spot, this will attract the curve more strongly to itself.

• Suppose an original sequence of control points A,B,C,D,E,F,G.

B-Splines

Page 41: Curves & Surfaces - Departamento de Informáticadirinfo.unsl.edu.ar/.../abm/...curves-surfaces_15.pdf · Curves & Surfaces • Polylines and polygons are piecewise linear approximations

Dpto. de Informática 41 - Roberto Guerrero @ 2015

Curves & SurfacesCurves & Surfaces

• Bezier curves are a special case of B-splines.• The degree of the Bernstein polynomials (L) and the order

of the B-spline m are related: m = L + 1.

• The first m knots have the value 0.• The last m knots have the value 1.• t varies from [0,1].• Suppose L = 5 and m = 6, the knot vector is:

B-Splines & Bezier Curves

T = (0,0,0,0,0,0, 1,1,1,1,1,1)

N k , L+1( t)=B kL( t)

Page 42: Curves & Surfaces - Departamento de Informáticadirinfo.unsl.edu.ar/.../abm/...curves-surfaces_15.pdf · Curves & Surfaces • Polylines and polygons are piecewise linear approximations

Dpto. de Informática 42 - Roberto Guerrero @ 2015

Curves & SurfacesCurves & Surfaces

Non Uniform Rational B-Splines• Are B-splines curves that uses a slightly different set of blending functions.• The new functions conjures up a set of weights

{w1, w2, w3,... wL}.

NURBS

R (t) P k

P(t) =k

R (t) =k

wk N (t) k,m

wk N (t) k,m

2

Page 43: Curves & Surfaces - Departamento de Informáticadirinfo.unsl.edu.ar/.../abm/...curves-surfaces_15.pdf · Curves & Surfaces • Polylines and polygons are piecewise linear approximations

Dpto. de Informática 43 - Roberto Guerrero @ 2015

Curves & SurfacesCurves & Surfaces

• Example

NURBS

Page 44: Curves & Surfaces - Departamento de Informáticadirinfo.unsl.edu.ar/.../abm/...curves-surfaces_15.pdf · Curves & Surfaces • Polylines and polygons are piecewise linear approximations

Dpto. de Informática 44 - Roberto Guerrero @ 2015

Curves & SurfacesCurves & Surfaces

Ruled Surface based on B-Splines• Two end curves P0(u) and P1(u) that are conected by a straight line at each value of u.

• Now the curves are represented by a B-spline curve.

Curved Surfaces

P u , v =1−v P 0uvP1u

P (u , v)=∑k=0

3

Bk3(u )((1−v) Pk

0+vP k

1)

Page 45: Curves & Surfaces - Departamento de Informáticadirinfo.unsl.edu.ar/.../abm/...curves-surfaces_15.pdf · Curves & Surfaces • Polylines and polygons are piecewise linear approximations

Dpto. de Informática 45 - Roberto Guerrero @ 2015

Curves & SurfacesCurves & Surfaces

Surface of Revolution based on B-Splines• A surface of revolution has the resulting parametric form.

• Expresing this using a B-spline curve.

Curved Surfaces

P u , v = X v cos u , X v sin u , Z v

( X (u) , Z (v ))=∑k=0

L

N k , m(v )(X k , Z k )

Page 46: Curves & Surfaces - Departamento de Informáticadirinfo.unsl.edu.ar/.../abm/...curves-surfaces_15.pdf · Curves & Surfaces • Polylines and polygons are piecewise linear approximations

Dpto. de Informática 46 - Roberto Guerrero @ 2015

Curves & SurfacesCurves & Surfaces

Bezier Surface Patches• Involves determine a control polyhedron, a network of (M+1)(L+1) control points

Curved Surfaces

ML

P(u,v) = Bi (u) Bk (v) Pi,k M L

i

Page 47: Curves & Surfaces - Departamento de Informáticadirinfo.unsl.edu.ar/.../abm/...curves-surfaces_15.pdf · Curves & Surfaces • Polylines and polygons are piecewise linear approximations

Dpto. de Informática 47 - Roberto Guerrero @ 2015

Curves & SurfacesCurves & Surfaces

Patching together Bezier Patches• The designer must choose the identical boundary control polygons for the two patches.

Curved Surfaces

Page 48: Curves & Surfaces - Departamento de Informáticadirinfo.unsl.edu.ar/.../abm/...curves-surfaces_15.pdf · Curves & Surfaces • Polylines and polygons are piecewise linear approximations

Dpto. de Informática 48 - Roberto Guerrero @ 2015

Curves & SurfacesCurves & Surfaces

B-Splines Patches• Involves determine a control polyhedron, a network of (M+1)(L+1) control points

P(u,v) = Ni,m (u) Nk,n (v) Pi,k LM

i

Curved Surfaces

Page 49: Curves & Surfaces - Departamento de Informáticadirinfo.unsl.edu.ar/.../abm/...curves-surfaces_15.pdf · Curves & Surfaces • Polylines and polygons are piecewise linear approximations

Dpto. de Informática 49 - Roberto Guerrero @ 2015

Curves & SurfacesCurves & Surfaces

NURBS Surfaces• Involves determine a control polyhedron,

a network of (M+1)(L+1) control points

wi,k Pi,k Ni,m (u) Nk,n (v)

LM

i

wi,k Ni,m (u) Nk,n (v)

LM

i

P(u,v) =

Curved Surfaces

Page 50: Curves & Surfaces - Departamento de Informáticadirinfo.unsl.edu.ar/.../abm/...curves-surfaces_15.pdf · Curves & Surfaces • Polylines and polygons are piecewise linear approximations

Dpto. de Informática 50 - Roberto Guerrero @ 2015

Curves & SurfacesCurves & Surfaces