 # Cubic Bezier and B-Spline Curves

## Presentation on theme: "Cubic Bezier and B-Spline Curves"— Presentation transcript:

Cubic Bezier and B-Spline Curves
Geometric Modeling Curves (continued) Cubic Bezier and B-Spline Curves Farin Chapters 4-5, 6, 8 Mortenson Chapters 4, 5

4 Typical Types of Parametric Curves
Control points influence curve shape. Interpolating Curve passes through all control points. Hermite Defined by its 2 endpoints and tangent vectors at endpoints. Interpolates all its control points. Not invariant under affine transformations. Special case of Bezier and B-Spline. Bezier* Interpolates first and last control points. Invariant under affine transformations. Curve is tangent to first and last segments of control polygon. Easy to subdivide. Curve segment lies within convex hull of control polygon. Variation-diminishing. Special case of B-spline. B-Spline* Not guaranteed to interpolate control points. Greater local control than Bezier. *focus of this lecture source: Mortenson, Angel

Notation Mortenson Farin Control points and parameter:
source: Mortenson, Farin

Bezier Curves Farin Chapter 4
The de Casteljau Algorithm

Parabola Construction
Change of notation from Chapter 3 (previously): Now: Add: By substitution: source: Farin

The de Casteljau Algorithm
Conceptually elegant, but not necessarily the fastest algorithm… Given: set: Example: cubic curve point source: Farin source: Farin

Some Bezier Curve Properties
Affine invariance: Linear interpolation is affinely invariant. Invariance under affine parameter transformations (beyond [0,1] to [a,b]): Convex hull: Curve stays within convex hull of control polygon. Each intermediate point is a convex barycentric combination of previously generated points. Planar control polygon generates planar curve. Helpful for intersection tests. Endpoint interpolation: Curve passes through b0 and bn. Verify using scheme for t =0 and t =1. source: Farin

Bezier Curves Farin Chapter 5-6 & Mortenson Chapter 4
The Bernstein Form of a Bezier Curve

Bernstein polynomials.
Bezier Geometric form (cubic case): Bernstein polynomials. 4 = number of control points = degree + 1 Evaluate at u=0 and u=1 to show tangents related to first and last control polygon line segment. source: Mortenson

Bezier Geometric form (general case):
Bernstein polynomials. n+1 = number of control points = degree + 1 Rational form is invariant under perspective transformation: where hi are projective space coordinates (weights) See Chapter 13 of Farin for rational Bezier material. source: Mortenson

More Bezier Curve Properties
Symmetry: Bernstein polynomials are symmetric with respect to u and 1- u. Convex Hull (again): Convex combination, so Bezier curve points all lie within convex hull of control polygon. Bezier curve with 4 control points source: Farin, Mortenson

More Bezier Curve Properties
Degree elevation leaving curve unchanged Adding a control point elevates degree by 1. New vertices b(1)i obtained from old polygon by piecewise linear interpolation at parameter values i/(n+1). New control polygon is in convex hull of old one. source: Farin

More Bezier Curve Properties
Repeated degree elevation: (in the limit) produces control polygon sequence that converges to the actual curve. Variation Diminishing: Piecewise linear interpolation is variation diminishing. Degree elevation uses piecewise linear interpolation. Each successive control polygon cannot intersect a given plane more often than the control polygon upon which it is based. Thus, the curve cannot intersect the plane more often than any of the control polygons. Corollary: convex control polygon produces convex curve segment. source: Farin

Composite Bezier Curves
Joining adjacent curve segments is an alternative to degree elevation. Collinearity of cubic Bezier control points produces G1 continuity at join point: Evaluate at u=0 and u=1 to show tangents related to first and last control polygon line segment. For G2 continuity at join point, 5 vertices must be coplanar. source: Mortenson

B-Spline Curves Mortenson Chapter 5 & Farin Chapter 8

See Chapter 13 of Farin for rational B-spline material.
Geometric form (non-uniform, non-rational case), where K controls degree (K -1) of basis functions: Cubic B-splines can provide C2 continuity at curve segment join points. N ti are n+1+K knot values that relate u to the control points. Uniform case: space knots at equal intervals of u. Repeated knots move curve closer to control points. Convex combination, so B-spline curve points all lie within convex hull of control polygon. Rational form (NURBS) is invariant under perspective transformation, where hi are projective space coordinates (weights). See Chapter 13 of Farin for rational B-spline material. source: Mortenson

Some B-Spline Curve Properties
Affine invariance: Linear interpolation is affinely invariant. Invariance under affine parameter transformations (beyond [0,1] to [a,b]): Convex hull: Curve stays within convex hull of control polygon (see later slide). Each intermediate point is a convex barycentric combination of previously generated points. Planar control polygon generates planar curve. Helpful for intersection tests. No endpoint interpolation: unlike Bezier Variation diminishing Transformation to some other parametric forms: B-Spline curve can be transformed into Bezier form. See Mortenson p. 170. B-Spline curve can be transformed into Hermite form. See Mortenson p source: Farin, Mortenson

Cubic B-Spline Geometric form (cubic case):
B-spline cubic basis functions 4 = number of control points = degree + 1 Convex combination, so B-spline curve points all lie within convex hull of control polygon. Uniform cubic B-spline: N1,4 N2,4 N3,4 N4,4 Evaluate at u=0 and u=1 to show curve endpoints and tangent directions related to control polygon. source: Mortenson

More B-Spline Curve Properties
Symmetry: Basis functions possess parametric symmetry: Example: Uniform cubic B-spline: N1,4 N2,4 N3,4 N4,4 source: Farin, Mortenson

Shape Characterization of Uniform Cubic B-Spline Curve Segment
Shape depends on control polygon 3 (non-collinear) control points determine triangle Type of curve segment and its monotonicity depends on location of 4th point p3 relative to triangle p0, p1, p2: SP: spiral control polygon induces convex, monotone curve segment. U: U-shaped convex control polygon induces convex, monotone curve segment. V:V-shaped convex control polygon induces 1 inflection point at curve segment endpoint. Curve segment is convex, monotone. N: N-shaped control polygon induces1 inflection point with convex, monotone pieces on both sides of inflection point. SI: self-intersecting control polygon induces 1 or 2 monotone curve subsegments. D: self-intersecting control polygon may induce loop, cusp or 2 inflection points. In all cases, curve segment can be partitioned into at most 2 monotone pieces. p0 p1 p2 SP SI U V N D source: Daniels, et al. building on Wang et al.

The deBoor Algorithm Given: knots & control points
Conceptually elegant, but not necessarily the fastest algorithm… Given: knots & control points & parameter u, generalize de Casteljau algorithm. Example: quadratic case with 4 knots and 3 control points K , 1 u knot sequence u0, u1, u2, u3 = 0, 1, 3, 4 and u = 2.0 curve point source: Farin source: Farin

OpenGL Demo to accompany HW#2
Geometric Modeling OpenGL Demo to accompany HW#2