Representing Curves and Surfaces 1 Introduction • We need smooth curves and surfaces in many applications: – – – – – model real world objects computer-aided design (CAD) high quality fonts data plots artists sketches 2 Introduction • Most common representation for surfaces: – polygon mesh – parametric surfaces – quadric surfaces • Solid modeling – don’t miss the next episode... 3 Introduction • Polygon mesh: – set of connected planar surfaces bounded by polygons – good for boxes, cabinets, building exteriors – bad for curved surfaces – errors can be made arbitrarily small at the cost of space and execution time – enlarged images show geometric aliasing 4 Introduction • Parametric polynomial curves: – point on 3D curve = (x(t), y(t), z(t)) – x(t), y(t), and z(t) are polynomials – usually cubic: cubic curves 5 Introduction • Parametric bivariate (two-variable) polynomial surface patches: – point on 3D surface = (x(u,v), y(u,v), z(u,v)) – boundaries of the patches are parametric polynomial curves – many fewer parametric patches than polynomial patches are needed to approximate a curved surface to a given accuracy – more complex algorithms though 6 Parametric cubic curves • Polylines and polygons: – large amounts of data to achieve good accuracy – interactive manipulation of the data is tedious • Higher-order curves: – more compact (use less storage) – easier to manipulate interactively • Possible representations of curves: – explicit, implicit, and parametric 7 Parametric cubic curves • Explicit functions: – y = f(x), z = g(x) – impossible to get multiple values for a single x • break curves like circles and ellipses into segments – not invariant with rotation • rotation might require further segment breaking – problem with curves with vertical tangents • infinite slope is difficult to represent 8 Parametric cubic curves • Implicit equations: – f(x,y,z) = 0 – equation may have more solutions than we want • circle: x² + y² = 1, half circle: ? – problem to join curve segments together • difficult to determine if their tangent directions agree at their joint point 9 Parametric cubic curves • Parametric representation: – x = x(t), y = y(t), z = z(t) – overcomes problems with explicit and implicit forms – no geometric slopes (which may be infinite) – parametric tangent vectors instead (never infinite) – a curve is approximated by a piecewise polynomial curve 10 Parametric cubic curves • Why cubic? – lower-degree polynomials give too little flexibility in controlling the shape of the curve – higher-degree polynomials can introduce unwanted wiggles and require more computation – lowest degree that allows specification of endpoints and their derivatives – lowest degree that is not planar in 3D 11 Parametric cubic curves • Kinds of continuity: – G0: two curve segments join together – G1: directions of tangents are equal at the joint – C1: directions and magnitudes of tangents are equal at the joint – Cn: directions and magnitudes of n-th derivative are equal at the joint 12 Parametric cubic curves • Major types of curves: – Hermit • defined by two endpoints and two tangent vectors – Bezier • defined by two endpoints and two other points that control the endpoint tangent vectors – Splines • several kinds, each defined by four points • uniform B-splines, non-uniform B-splines, ß-splines 13 Parametric cubic curves • General form: x(t ) a x t 3 bx t 2 c x t d x y (t ) a y t 3 by t 2 c y t d y z (t ) a z t 3 bz t 2 c z t d z ax a y az b b b x y z C T [t 3 t 2 t 1] cx c y cz d d d x y z Q(t ) [ x(t ) y (t ) z (t )] T C T M G 14 Parametric cubic curves • It is not necessary to choose a single representation, since it is possible to convert between them. • Interactive editors provide several choices, but internally they usually use NURBS, which is the most general. 15 Parametric bicubic surfaces • Generalization of parametric cubic curves. Q( s, t ) T C (t ) T M G (t ) • For each value of s there is a family of curves in t. • Major kinds of surfaces: – Hermit, Bezier, B-spline 16 Parametric bicubic surfaces • Displaying bicubic surfaces: – brute-force iterative evaluation is very expensive (the surface is evaluated 20,000 times if step in parameters is 0.01) – forward-difference methods are better, but still expensive – fastest is adaptive subdivision, but it might create cracks 17 Quadric surfaces • Implicit form: f ( x, y, z ) ax 2 by 2 cz 2 2dxy 2eyz 2 fxz 2 gx 2hy 2 jz k 0 • Particularly useful for molecular modeling. • Alternative to rational surfaces if only quadric surfaces are being represented. 18 Quadric surfaces • Reasons to use them: – – – – easy to compute normal easy to test point inclusion easy to compute z given x and y easy to compute intersections of one surface with another 19 Summary • Polygon meshes – – – – – well suited for representing flat-faced objects seldom satisfactory for curved-faced objects space inefficient simpler algorithms hardware support 20 Summary • Piecewise cubic curves and bicubic surfaces – – – – – – – permit multiple values for a single x or y represent infinite slopes easier to manipulate interactively can either interpolate or approximate space efficient more complex algorithms little hardware support 21