Professional Documents
Culture Documents
B-Splines and NURBS: Outline
B-Splines and NURBS: Outline
B-Splines and NURBS: Outline
Computer Graphics I
• Types of Curves
– Splines
B-Splines and NURBS – B-splines
Week 5, Lecture 9
– NURBS
David Breen, William Regli and Maxim Peysakhov • Knot sequences
Geometric and Intelligent Computing Laboratory
• Effects of the weights
Department of Computer Science
Drexel University
http://gicl.cs.drexel.edu
1 2
5 6
1
B-splines B-splines:
• Defined similarly to Bézier curves Cox-deBoor Recursion
– pi are the control points • Cox-deBoor Algorithm: defines the blending
– Computed with basis functions (Basis-splines) functions for spline curves (not limited to deg 3)
• B-spline basis functions are blending functions – curves are weighted avgs of lower degree curves
– Each point on the curve is defined by the • Let Bi ,d (t ) denote the i-th blending function for a
blending of the control points B-spline of degree d, then:
(Bi is the i-th B-spline blending function)
m 1, if t k ≤ t < t k +1
Bk , 0 (t ) =
p (t ) = ∑ Bi ,d (t ) pi 0, otherwise
i =0 t − tk t −t
Bk ,d (t ) = Bk ,d −1 (t ) + k + d +1 Bk +1,d −1 (t )
– Bi is zero for most values of t! 7
tk +d − tk t k + d +1 − t k +1 8
2
Uniform B-splines:
Setting the Options Example: Creating a B-spline
m
• Specified by
– m ≥ 3
p (t ) = ∑ Bi ,d (t ) pi • m=9
• 10 control points
i =0
– m+1 control points, P0 … Pm • 8 knot points
– m-2 cubic polynomial curve segments, Q3…Qm • 7 segments
– m-1 knot points, t3 … tm+1
– segments Qi of the B-spline curve are
• defined over a knot interval [ti , ti +1 ]
• defined by 4 of the control points, Pi-3 … Pi
– segments Qi of the B-spline curve are blended
together into smooth transitions via
(the new & improved) blending functions
14 15
1994 Foley/VanDam/Finer/Huges/Phillips ICG
B-splines:
B-spline: Knot Sequences
Cox-deBoor Recursion
• Even distribution of knots • Cox-deBoor Algorithm: defines the blending functions for
– uniform B-splines spline curves (not limited to deg 3)
– Curve does not interpolate end points – curves are weighted avgs of lower degree curves
• first blending function not equal to 1 at t=0 • Let Bi,d (t) denote the i-th blending function for a B-spline
• Uneven distribution of knots of degree d, then:
– non-uniform B-splines
– Allows us to tie down the endpoints by repeating knot values
(in Cox-deBoor, 0/0=0) € 1, if t k ≤ t < t k +1
– If a knot value is repeated, it increases the effect (weight) of the
Bk , 0 (t ) =
blending function at that point
0, otherwise
– If knot is repeated d times, blending function converges to 1 and t − tk t −t
the curve interpolates the control point
Bk ,d (t ) = Bk ,d −1 (t ) + k + d +1 Bk +1,d −1 (t )
16
tk +d − tk t k + d +1 − t k +1 17
Creating a Non-Uniform
B-splines: Multiple Knots
B-spline: Knot Selection
• Given curve of degree d=3, with m+1 control • Knot Vector
points {0.0, 0.0, 0.0, 3.0, 4.0, 5.0, 6.0, 7.0}
18 19
Pics/Math courtesy of G. Farin @ ASU From http://devworld.apple.com/dev/techsupport/develop/issue25/schneider.html
3
m
p (t ) = ∑ Bi ,d (t ) pi
i =0
B-spline Summary Watching Effects 00123456789
of Knot Selection
1, if t k ≤ t < t k +1
Bk , 0 (t ) = • 9 knot points (initially)
0, otherwise
t − tk t −t – Note: knots are distributed
Bk ,d (t ) = Bk ,d −1 (t ) + k + d +1 Bk +1,d −1 (t )
tk +d − tk t k + d +1 − t k +1 parametrically based on t,
hence why they “move”
• 10 control points
• Curves have as many
segments as they have
non-zero intervals in u degree of
curve
20 21
Pics/Math courtesy of G. Farin @ ASU
22 23
1994 Foley/VanDam/Finer/Huges/Phillips ICG
Recorded from: http://heim.ifi.uio.no/~trondbre/OsloAlgApp.html
• Derivative:
p′(u ) = c1 + 2c2u + 3c3u 2
Easy to show C0 , C1 , C2
25 26
1994 Foley/VanDam/Finer/Huges/Phillips ICG
4
B-splines: Setting the Options NURBS
• How to space the knot points? • At the core of several
– Uniform modern CAD systems
– I-DEAS, Pro/E, Alpha_1
• equal spacing of knots along the curve
– Non-Uniform • Describes analytic and
freeform shapes
• Which type of parametric function?
• Accurate and efficient
– Rational evaluation algorithms
• x(t), y(t), z(t) defined as ratio of cubic polynomials
• Invariant under affine and
– Non-Rational perspective transformations
27 28
U of Utah, Alpha_1
Benefits of
NURBS
Rational Spline Curves
• Invariant under rotation, scale, translation, Non-uniform Rational B-splines: NURBS
perspective transformations
– transform just the control points, • Basic idea: four dimensional non-uniform B-splines,
then regenerate the curve followed by normalization via homogeneous coordinates
– (non-rationals only invariant under rotation, scale – If Pi is [x, y, z, 1], results are invariant wrt perspective projection
and translation) • Also, recall in Cox-deBoor, knot spacing is arbitrary
• Can precisely define the conic sections and – knots are close together,
influence of some control points increases
other analytic functions – Duplicate knots can cause points to interpolate
– conics require quadratic polynomials – e.g. Knots = {0, 0, 0, 0, 1, 1, 1, 1} create a Bézier curve
– conics only approximate with non-rationals
29 30
5
NURBS: Notation Alert NURBS: Notation Alert
• Depending on the source/reference 1. If defined using homogenous
– Blending functions are either Bi ,d (u ) or N i ,d (u ) coordinates, the 4th (3rd for 2D)
– Parameter variable is either u or t dimension of each Pi is the weight
– Curve is either C or P or Q
– Control Points are either Pi or Bi 2. If defined as weighted euclidian, a
– Variables for order, degree, number of control separate constant wi, is defined for
points etc are frustratingly inconsistent each control point
• k, i, j, m, n, p, L, d, ….
33 34
∑ i =0
wi Bi ,d (u ) n −1
Where Allows us to write: C (u ) = ∑ Ri ,d (u ) Pi
i =0
– control points,
– d-th degree B-spline blending functions, Bi ,d (u ) Where Ri,d (u ) are rational basis functions
– the weight, wi, for control point Pi – piecewise rational basis functions on u ∈ [0,1]
(when all wi=1, we have a B-spline curve) 35 – weights are incorporated into the basis fctns
36
Geometric Interpretation of
NURBS: Examples
NURBS
• With Homogeneous coordinates, a rational n- • Unif. Knot Vector • Non-Unif. Knot Vector
D curve is represented by polynomial curve in
(n+1)-D
• Homogeneous 3D control points are written
as:
in 4D where {0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0} {0.0, 1.0, 2.0, 3.75, 4.0, 4.25, 6.0, 7.0}
• To get , divide by wi
– a perspective transform with center at the origin
• Note: weights can allow final curve shape to
go outside the convex hull (i.e. negative w) 37 38
From http://devworld.apple.com/dev/techsupport/develop/issue25/schneider.html
6
NURBS: Examples NURBS: Examples
• Knot Vector • Knot Vector
{0.0, 0.0, 0.0, 3.0, 4.0, 5.0, 6.0, 7.0}
{0.0, 1.0, 2.0, 3.0, 3.0, 5.0, 6.0, 7.0}
41 42
From http://devworld.apple.com/dev/techsupport/develop/issue25/schneider.html
Programming assignment 3
• Input PostScript-like file containing polygons
• Output B/W XPM
• Implement viewports
• Use Sutherland-Hodgman intersection for
polygon clipping
• Implement scanline polygon filling. (You
cannot use flood filling)
43