Curves and Surfaces
B-spline Curves These curves are approximating rather than interpolating curves. The curves come close to, but may not actually pass through, the control points. Usually used as multiple, joined curve segments B-splines have C 2 continuity between curve segments Smoother than other curve forms For a sequence of connected B-spline curves, each curve segment is determined from four control points. Each control point contributes to 4 curve segments (except the first three and last three) 2
B-spline Curves (2) By convention, curve segment Q i is determined by control points P i-3, P i-2, P i-1, and P i Rather than defining each curve segment on the interval 0 t 1, we make the parameter domains sequential. Curve segment Q i is defined on the parameter range t i t t i+1 Between two curve segments Q i-1 and Q i there is a join point or knot at parameter value t i A uniform B-spline has knots that are equally spaced in t. 3
B-spline Curve Example P 1 P 2 P 3 P 6 t 4 t 7 t 3 t 5 P 0 P 4 t 6 P 5 4
B-spline Geometry The B-spline geometry vector is given by G BS P P P The first curve segment, Q 3 is defined by P 0 to P 3 over the parameter t 3 = 0 to t 4 = 1 The second curve segment, Q 4 is defined by P 1 to P 4 over the parameter t 4 = 1 to t 5 = 2 The curve segment, Q m is defined by P m-3 to P m over the parameter t m = m-3 to t m+1 = m-2 i 3 i 2 i 1 P i 5
6 B-spline Properties Since each control point contributes to four curve segments, moving one control point alters four curve segments, but does not alter the others. Because of the way we have parameterized t, we define Then the curve segment is computed as 1 ) ( ) ( ) ( 2 3 i i i i t t t t t t T 1, ) ( i i Bs Bs i i t t t G M T t Q
7 B-spline Properties The B-spline basis matrix M Bs is defined as B-spline curve joins maintain C 2 continuity B-splines are bounded by their convex hulls 0 1 4 1 0 3 0 3 0 3 6 3 1 3 3 1 6 1 M Bs
Drawing Curves Once we have the curves defined, how do we draw them? Two approaches: 1. Evaluate x(t), y(t), and z(t) for incrementally spaced values of t in an iterative fashion. Draw line segments between the points at each iteration Can optimize using Horner s method or forward differences 2. Recursively subdivide the curve until the new control points get sufficiently close to the curve Can generate a large number of curve segments 8
Advantages of B-spline curves B-spline curves require more information and a more complex theory than Bézier curves. But it has advantages to offset these shortcomings. a B-spline curve can be a Bézier curve. B-spline curves satisfy all important properties that Bézier curves have. B-spline curves provide more control flexibility than Bézier curves can do. 9
Properties of B-spline curves We can change the position of a control point without globally changing the shape of the whole curve. Since B-spline curves satisfy the strong convex hull property, they have a finer shape control. There are other techniques for designing and editing the shape of a curve such as changing knots. B-spline curves are still polynomial curves and polynomial curves cannot represent many useful simple curves such as circles and ellipses. 10
Localized Control Moving the control point B 7 only changes the curve near that point. 11
Problems with B-splines B-splines cannot represent conic sections In order to represent them, we can use a ratio of polynomials Q ( t) p p 1 2 ( t) ( t) 12
NURBS NURBS are one form of rational polynomial curves Non-Uniform Rational B-Spline Defined by : its order determines the number of control points that affect a region of the curve The polynomial is degree one less than the order (i.e. order 4 is cubic polynomial) a set of weighted control points a knot vector a sequence of values that determine how the control points affect the curve NURBS curves are generalizations of both B-splines and Bezier curves 13
NURBS NURBS are one form of rational polynomial curves Non-Uniform Rational B-Spline Defined by: Q ( t ) n i 1 i i i, k n w w B N N i 1 i i, k ( t ) ( t ) with: w i scalar wei ght for each control point B i control points N i, k ( t ) the B - spline curve k B - spline parameter 14
NURBS If the weights are set to 1, the NURBS becomes a regular B-spline NURBS can represent conics exactly. 15
Non-Uniform Uniform Knot Vector {0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0} Non-Uniform Knot Vector {0.0, 1.0, 2.0, 3.75, 4.0, 4.25, 6.0, 7.0} The knot intervals for B 2 and B 3 : {3.75, 4.0} and {4.0, 4.25} are narrower. 16
NURBS examples (from U of Calgary) 17
Parametric Bicubic Surfaces An extension to curves by adding another dimension t = 1.0 t = 0.2 t = 0.8 t = 0.6 t = 0.4 t = 0.0 s = 0.0 s = 0.2 s = 0.4 s = 0.6 s = 0.8 s = 1.0 18
Curve Equation Remember, the equation of the curve is: Q ( t ) TMG Or, equivalently: Q ( s) SMG Where G is the geometry vector, and s is a constant 19
20 The Surface Equations If we allow G to be a function, we get i.e., the geometry can now change, based on t ) ( ) ( ) ( ) ( ) ( ), ( 4 3 2 1 t G t G t G t G SM t SMG t s Q
The Surface Equations For a fixed t 1, Q(s, t 1 ) is a curve, since G(t 1 ) is a constant. Taking a new t 2 that is near in value to t 1 will give another curve which is slightly different from the first. Repeating the process for some number of parameters t, with 0 t < 1 will give a group of curves that define a surface. 21
22 The Surface Equations Each of the G i (t) functions are cubics, and can be represented as: where i G i TM t G ) ( 4 3 2 1 i i i i i g g g g G
Surface Equations Taking the transpose of this gives us G i ( t ) G i T M T T T If we substitute this back into our original equation, and expand to include all four geometry terms, we get: Q ( s, t) SM G T M T T T 23
24 Surface Equations So, With being the geometry matrix and M being the basis matrix. T T T x T M SM G t s x ), ( T T T y T M SM G t s y ), ( T T T z T M SM G t s z ), ( G
Bezier Surfaces The ends of each patch require 4 control points in the s direction. The t direction gives rise to 4 control points also Thus, there are 4x4 or 16 control points required for each patch. 25
Bezier Surface Example 26
Joining Bezier Surfaces P 21 Multiple Bezier surfaces can be joined with C 0 continuity by: P 41 P 31 P 42 P 43 P 32 P 11 P 22 P 12 P 23 P 33 P P 34 24 P 13 Making the four control points at the join common between the two patches P 44 P 45 P 46 P P 25 35 P 36 P 26 P 14 P 15 P 37 P 16 P 47 P 27 P 17 27
Joining Bezier Surfaces P 21 P 31 To join with C 1 continuity we must also enforce the following stipulations: 1. The control points on either side of the join must be collinear P 41 P 42 P 43 P 44 P 32 P 11 P 22 P 12 P 33 P 23 P 34 P 24 P 35 P 25 P 13 P 14 2. All of the pairs of line segments joining the three collinear control points must have lengths that have the same ratios P 45 P 46 P 47 P 36 P 26 P 37 P 27 P 15 P 16 P 17 28
Joining Bezier Surfaces P 21 For this example the following ratios must be equal: P 41 P 42 P 31 P 32 P 11 P 22 P 23 P 33 P 12 P 13 P 34 P 24 P P 13 14 P P 14 15 P P 23 24 P P 24 25 P P 33 34 P P 34 35 P P 43 44 P P 44 45 P 43 P 44 P 35 P 25 P 14 P 15 P 45 P 36 P 26 P 46 P 37 P 16 P 47 P 27 29 P 17
Displaying Surfaces Surfaces are displayed in a manner similar to curves. 1. Iteratively evaluate the surface equation at s and t intervals, then draw polygons for those patches 2. Subdivide the surface until the patch size is small enough 30
NURBS Surfaces NURBS Non Uniform - knots can have any spacing desired Rational the blending functions are the ratios of two polynomials B-Spline the surface type is B-spline Very flexible and powerful Also somewhat complex Can represent conics exactly Used extensively, particularly in CAD 31
NURBS Examples http://www.geomagic.com 32
http://gallery.mcneel.com/ 33
http://gallery.mcneel.com/ 34
http://gallery.mcneel.com/ 35
NURBS in OpenGL glunurbssurface(glunurbs *nurb, Glint sknotcount, GLfloat *sknots, Glint tknotcount, GLfloat *tknots, Glint sstride, Glint tstride, GLfloat *control, Glint sorder, Glint torder, GLenum type) 36
NURBS in OpenGL nurb specifies the NURBS object created with glunewnurbsrenderer sknotcount number of knots in the s direction sknots the array of s knots tknotcount number of knots in the t direction tknots the array of t knots sstride offset between control points in the s direction tstride offset between control points in the t direction control array of control points glunurbssurface(glunurbs *nurb, Glint sknotcount, GLfloat *sknots, Glint tknotcount, GLfloat *tknots, Glint sstride, Glint tstride, GLfloat *control, Glint sorder, Glint torder, GLenum type) sorder order of the NURBS in s torder order of the NURBS in t type type of surface 37
Trimming Curves Sometimes we want holes in the surface Can define them using trimming curves Define a NURBS curve on the NURBS surface Draw the surface everywhere except inside the curve 38
39
40
Subdivision Surfaces One problem with the surfaces we have discussed is the difficulty in changing resolution for a portion of the surface If we want more detail at one part of the patch, we have to introduce a whole new patch Subdivision surfaces allow local refinement of the control mesh This gives more flexibility in the objects to be modeled 41
Subdivision Surfaces Idea: recursively subdivide the patch to finer and finer resolution Refinement 1 Refinement 2 Refinement 42
Standard Subdivision Given initial control points, recursively subdivide until desired smoothness is reached 43
Adaptive Subdivision Generally some areas of the surface have higher curvature, and thus should be subdivided further than other areas Can apply an adaptive subdivision scheme to subdivide more where we want finer control of the surface 44
Adaptive Subdivision Surface Example Original Mesh After one refinement After two refinements The limit infinite refinement from http://grail.cs.washington.edu/projects/subdivision/ 45
Subdivision Surfaces Geri s Game (1997) : Pixar Animation Studios 46
Subdivision Surface Example http://mrl.nyu.edu/~dzorin/sig98course/multires/sld005.htm 47
Allowing for Sharp Edges and Creases Often we want to permit sharp edges How can we smooth some of the surface, but not all? Tag edges as sharp or non-sharp If an edge is sharp, apply sharp subdivision rules Otherwise apply normal subdivision rules 48
T-splines Introduced by Dr. Sederberg in 2003 Allow T-junctions in the surfaces T-junction 49
T-Splines 50
T-spline Hole Filling 51
T-spline example 52
Summary Surfaces allow for a higher level of realism Used in all CAD packages NURBS surfaces are the most popular type Subdivision surfaces allow for increased surface detail, and for local adaptation T-splines allow for even more flexibility 53