1 / 31

B-Splines: Blending Functions, Knot Vectors, and Surface Patches

Learn about B-splines, including blending functions, knot vectors, and surface patches. Understand the differences between uniform and non-uniform B-splines and explore their applications in curve and surface design.

stonej
Télécharger la présentation

B-Splines: Blending Functions, Knot Vectors, and Surface Patches

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Last Time • BSplines (C) University of Wisconsin

  2. Today • More B-splines • Surface patches (C) University of Wisconsin

  3. Non-Uniform B-Splines • Uniform B-splines are a special case of B-splines • Each blending function is the same • A blending functions starts at t=-3, t=-2, t=-1,… • Each blending function is non-zero for 4 units of the parameter • Non-uniform B-splines can have blending functions starting and stopping anywhere, and the blending functions are not all the same (C) University of Wisconsin

  4. B-Spline Knot Vectors • Knots: Define a sequence of parameter values at which the blending functions will be switched on and off • Knot values are increasing, and there are n+d+1 of them, forming a knot vector: (t0,t1,…,tn+d) with t0 t1  …  tn+d • Curve only defined for parameter values between td-1 and tn+1 • These parameter values correspond to the places where the pieces of the curve meet • There is one control point for each value in the knot vector • The blending functions are recursively defined in terms of the knots and the curve degree (C) University of Wisconsin

  5. B-Spline Blending Functions • The recurrence relation starts with the 1st order B-splines, just boxes, and builds up successively higher orders • This algorithm is the Cox - de Boor algorithm • Carl de Boor is a professor here (C) University of Wisconsin

  6. Uniform Cubic B-splines • Uniform cubic B-splines arise when the knot vector is of the form (-3,-2,-1,0,1,…,n+1) • Each blending function is non-zero over a parameter interval of length 4 • All of the blending functions are translations of each other • Each is shifted one unit across from the previous one • Bk,d(t)=Bk+1,d(t+1) • The blending functions are the result of convolving a box with itself d times, although we will not use this fact (C) University of Wisconsin

  7. Bk,1 (C) University of Wisconsin

  8. Bk,2 (C) University of Wisconsin

  9. Bk,3 (C) University of Wisconsin

  10. B0,4 (C) University of Wisconsin

  11. B0,4 Note that the functions given on earlier slides are translates of this function obtained by using (t-1),(t-2) and (t-3) instead of just t, and then selecting only a sub-range of t values for each function (C) University of Wisconsin

  12. Interpolation and Continuity • The knot vector gives a user control over interpolation and continuity • If the first knot is repeated three times, the curve will interpolate the control point for that knot • Repeated knot example: (-3,-3,-3, -2, -1, 0, …) • If a knot is repeated, so is the corresponding control point • If an interior knot is repeated, continuity at that point goes down by 1 • Interior points can be interpolated by repeating interior knots • A deep investigation of B-splines is beyond the scope of this class (C) University of Wisconsin

  13. Rendering B-splines • Same basic options as for Bezier curves • Evaluate at a set of parameter values and join with lines • Hard to know where to evaluate, and how pts to use • Use a subdivision rule to break the curve into small pieces, and then join control points • What is the subdivision rule for B-splines? • Instead of subdivision, view splitting as refinement: • Inserting additional control points, and knots, between the existing points • Useful not just for rendering - also a user interface tool • Defined for uniform and non-uniform B-splines by the Oslo algorithm (C) University of Wisconsin

  14. Refining Uniform Cubic B-splines • Basic idea: Generate 2n-3 new control points: • Add a new control point in the middle of each curve segment: P’0,1, P’1,2, P’2,3 , …, P’n-2,n-1 • Modify existing control points: P’1, P’2, …, P’n-2 • Throw away the first and last control • Rules: • If the curve is a loop, generate 2n new control points by averaging across the loop • When drawing, don’t draw the control polygon, join the X(i) points (C) University of Wisconsin

  15. Rational Curves • Each point is the ratio of two curves • Just like homogeneous coordinates: • NURBS: x(t), y(t), z(t) and w(t) are non-uniform B-splines • Advantages: • Perspective invariant, so can be evaluating in screen space • Can perfectly represent conic sections: circles, ellipses, etc • Piecewise cubic curves cannot do this (C) University of Wisconsin

  16. Parametric Surfaces x(s,1) • Define points on the surface in terms of two parameters • Simplest case: bilinear interpolation s P1,1 P0,1 x(s,t) t P0,0 s x(s,0) P1,0 (C) University of Wisconsin

  17. Tensor Product Surface Patches • Defined over a rectangular domain • Valid parameter values come from within a rectangular region in parameter space: 0s<1, 0t<1 • Use a rectangular grid of control points to specify the surface • 4 points in the bi-linear case on the previous slide, more in other cases • Surface takes the form: • For some functions Fi,s and Fj,t (C) University of Wisconsin

  18. Bezier Patches • As with Bezier curves, Bin(s) and Bjm(t) are the Bernstein polynomials of degree n and m respectively • Most frequently, use n=m=3: cubic Bezier patch • Need 4x4=16 control points, Pi,j (C) University of Wisconsin

  19. Bezier Patches (2) • Edge curves are Bezier curves • Any curve of constant s or t is a Bezier curve • One way to think about it: • Each row of 4 control points defines a Bezier curve in s • Evaluating each of these curves at the same s provides 4 virtual control points • The virtual control points define a Bezier curve in t • Evaluating this curve at t gives the point x(s,t) x(s,t) (C) University of Wisconsin

  20. Properties of Bezier Patches • Which vertices, if any, does the patch interpolate? Why? • What can you say about the tangent plane at each corner? Why? • Does the patch lie within the convex hull of its control vertices? (C) University of Wisconsin

  21. Properties of Bezier Patches • The patch interpolates its corner points • Comes from the interpolation property of the underlying curves • The tangent plane at each corner interpolates the corner vertex and the two neighboring edge vertices • The tangent plane is the plane that is perpendicular to the normal vector at a point • The tangent plane property derives from the curve tangent properties and the way to compute normal vectors • The patch lies within the convex hull of its control vertices • The basis functions sum to one and are positive everywhere (C) University of Wisconsin

  22. Bezier Patch Matrix Form • Note that the 3 matrices stay the same if the control points do not change • The middle product can be pre-computed, leaving only: (C) University of Wisconsin

  23. Bezier Patch Meshes • A patch mesh is just many patches joined together along their edges • Patches meet along complete edges • Each patch must be a quadrilateral OK Not OK Not OK OK (C) University of Wisconsin

  24. Bezier Mesh Continuity • Just like curves, the control points must satisfy rigid constraints to ensure parametric continuity • How do we ensure C0 continuity along an edge? • How do we ensure C1 continuity along an edge? • How do we ensure C2 continuity along an edge? • For geometric continuity, constraints are less rigid • What can you say about the vertices around a corner if there must be C1 continuity at the corner point? (C) University of Wisconsin

  25. Bezier Mesh Continuity • Just like curves, the control points must satisfy rigid constraints to ensure parametric continuity • C0 continuity along an edge? Share control points at the edge • C1 continuity along an edge? Control points across edge are collinear and equally spaced • C2 continuity along an edge? Constraints extent to points farther from the edge • For geometric continuity, constraints are less rigid • Still collinear for G1, but can be anywhere along the line • What can you say about the vertices around a corner if there must be C1 continuity at the corner point? • They are co-planar (not the interior points, just corner and edge) (C) University of Wisconsin

  26. Rendering Bezier Patches • Option 1: Evaluate at fixed set of parameter values and join up with triangles • Can’t use quadrilaterals because points may not be co-planar • Ideal situation for triangle strips • Advantage: Simple, and OpenGL has commands to do it for you • Disadvantage: No easy way to control quality of appearance • Option 2: Subdivide • Allows control of error in the triangle approximation • Defined much like curve subdivision, but done once in each parametric direction (C) University of Wisconsin

  27. Midpoint Subdivision • Repeatedly join midpoints to find new control vertices • Do it first for each row of original control points: 4x4 -> 4x7 • Then do it for each column of new control points:4x7 -> 7x7 (C) University of Wisconsin

  28. A Potential Problem • One (good) way to subdivide, is: • If a control mesh is flat enough – draw it • Else, subdivide into 4 sub-patches and recurse on each • Problem: Neighboring patches may not be subdivided to the same level • Cracks can appear because join edges have different control meshes • This can be fixed by adding extra edges Crack (C) University of Wisconsin

  29. Computing Normal Vectors • The partial derivative in the s direction is one tangent vector • The partial derivative in the t direction is another • Take their cross product, and normalize, to get the surface normal vector (C) University of Wisconsin

  30. B-Spline Surfaces • Defined just like Bezier surfaces: • Continuity is automatically obtained everywhere • BUT, the control points must be in a rectangular grid OK Not OK (C) University of Wisconsin

  31. How to Choose a Spline • Hermite curves are good for single segments where you know the parametric derivative or want easy control of it • Bezier curves are good for single segments or patches where a user controls the points • B-splines are good for large continuous curves and surfaces • NURBS are the most general, and are good when that generality is useful, or when conic sections must be accurately represented (CAD) (C) University of Wisconsin

More Related