CS-84: Computer Graphics Lecture #5: Curves and Surfaces Prof. James O Brien University of California, Berkeley V25F-5-. Today General curve and surface representations Splines and other polynomial bases 2
Geometry Representations Constructive Solid Geometry (CSG) Parametric Polygons Subdivision surfaces Implicit Surfaces Point-based Surface Not always clear distinctions i.e. CSG done with implicits 3 Geometry Representations Object made by CSG Converted to polygons 4
Geometry Representations Object made by CSG Converted to polygons Converted to implicit surface 5 Geometry Representations CSG on implicit surfaces 6
Geometry Representations Point-based surface descriptions Ohtake, et al., SIGGRAPH 23 7 Geometry Representations Subdivision surface (different levels of refinement) Images from Subdivision.org 8
Geometry Representations Various strengths and weaknesses Ease of use for design Ease/speed for rendering Simplicity Smoothness Collision detection Flexibility (in more than one sense) Suitability for simulation many others... 9 Curves: Parametric Representations x = x(u) x R n u R Surfaces: x = x(u, v) x R n u, v R x = x(u) u R 2 Volumes: and so on... x = x(u, v, w) x = x(u) x R n u, v, w R u R 3 Note: a vector function is really n scalar functions
Parametric Rep. Non-unique Same curve/surface may have multiple formulae 3 3 2 2 - - 2 3 - - 2 3 x(u) = [u, u] x(u) = [u 3, u 3 ] Simple Differential Geometry Tangent to curve t(u) = x u Tangents to surface Normal of surface u tu(u, v) = x u u,v tv(u, v) = x v u,v ˆn = t u tv tu tv Also: curvature, curve normals, curve bi-normal, others... Degeneracies: x/ u = or tu tv = 2
Discretization Arbitrary curves have an uncountable number of parameters 3 2 - - 2 3 i.e. specify function value at all points on real number line 3 Discretization Arbitrary curves have an uncountable number of parameters Pick complete set of basis functions Polynomials, Fourier series, etc. Truncate set at some reasonable point x(u) = i= c i φ i (u) 3 3 x(u) = c i φ i (u) = c i u i i= i= Function represented by the vector (list) of The c i may themselves be vectors x(u) = c i 3 c i φ i (u) i= 4
Power Basis Polynomial Basis d x(u) = c i u i i= x(u) = C P d C = [c, c, c 2,..., c d ] P d = [, u, u 2,..., u d ] The elements of P d are linearly independant! i.e. no good approximation u k c i u i i k Skipping something would lead to bad results... odd stiffness 5 Specifying a Curve Given desired values (constraints) how do we determine the coefficients for cubic power basis? tu(u ) For now, assume u = u = x(u ) x(u ) tu(u ) u u 6
7 Specifying a Curve tu(u ) tu(u ) x(u ) x(u ) Given desired values (constraints) how do we determine the coefficients for cubic power basis? x() = c = x x() = c i = x x ()= c = x x ()= i c i = x 8 Specifying a Curve tu(u ) tu(u ) x(u ) x(u ) Given desired values (constraints) how do we determine the coefficients for cubic power basis? x x x x = 2 3 c c c 2 c 3 p = B c
9 Specifying a Curve tu(u ) tu(u ) x(u ) x(u ) Given desired values (constraints) how do we determine the coefficients for cubic power basis? c = β H p β H = B = 3 3 2 2 2 2 Specifying a Curve Given desired values (constraints) how do we determine the coefficients for cubic power basis? c = β H p β H = B = 3 3 2 2 2 tu(u ) tu(u ) x(u ) x(u ) x(u) = P 3 c = P 3 β H p = + u 3u 2 + 2u 3 + u + 3u 2 2u 3 + u 2u 2 + u 3 + u u 2 + u 3 p
Specifying a Curve Given desired values (constraints) how do we determine the coefficients for cubic power basis? c = β H p x(u) = + u 3u 2 + 2u 3 + u + 3u 2 2u 3 + u 2u 2 + u 3 + u u 2 + u 3 p Hermite basis functions x(u) = 3 tu(u ) x(u x(u ) ) tu(u ) i= p i b i (u) 2 Specifying a Curve Given desired values (constraints) how do we determine the coefficients for cubic power basis? tu(u ) Probably not to scale. x(u ) x(u ) tu(u ) Hermite basis functions x(u) = 3 i= p i b i (u) 22
Hermite Basis Specify curve by Endpoint values Endpoint tangents (derivatives) Parameter interval is arbitrary (most times) Don t need to recompute basis functions These are cubic Hermite Could do construction for any odd degree (d )/2 derivatives at end points 23 Cubic Bézier Similar to Hermite, but specify tangents indirectly x = p x = p 3 x = 3(p p ) x = 3(p 3 p 2 ) Note: all the control points are points in space, no tangents. 24
Cubic Bézier Similar to Hermite, but specify tangents indirectly 2 3 c = 3 3 3 3 p x = p x = p 3 x = 3(p p ) x = 3(p 3 p 2 ) c = 3 3 3 6 3 3 3 p c = β Z p 25 Cubic Bézier Plot of Bézier basis functions.8.6.4.2.2.4.6.8 26
Changing Bases Power basis, Hermite, and Bézier all are still just cubic polynomials The three basis sets all span the same space Like different axes in R 3 R 4 Changing basis c = β Z p Z c = β H p H p Z = β Z β H p H 27 Useful Properties of a Basis Convex Hull All points on curve inside convex hull of control points i b i (u) = b i (u) u Ω Bézier basis has convex hull property 28
Useful Properties of a Basis Invariance under class of transforms Transforming curve is same as transforming control points x(u) = p i b i (u) T x(u) = (T p i )b i (u) i i Bézier basis invariant for affine transforms Bézier basis NOT invariant for perspective transforms NURBS are though... 29 Useful Properties of a Basis Local support Changing one control point has limited impact on entire curve Nice subdivision rules Orthogonality ( ) Fast evaluation scheme Interpolation -vs- approximation Ω b i(u)b j (u)du = δ ij 3
DeCasteljau Evaluation A geometric evaluation scheme for Bézier u = u =.25 u =.5 u =.75 u = 3 Joining a C b = b C b a = c b b G b a b a = c b c b c If you change a, b, or c you must change the others But if you change a, b, or c you do not have to change beyond those three. *Local Support* 32
Hump Functions Constraints at joining can be built in to make new basis 33 Tensor-Product Surfaces Surface is a curve swept through space Replace control points of curve with other curves x(u, v) = i p i b i (u) i q i (v) b i (u) q i (v) = j p ji b j (v) x(u, v) = ij p ij b i (u)b j (v) b ij (u, v) = b i (u)b j (v) x(u, v) = ij p ij b ij (u, v) 34
Hermite Surface Bases.75.5.25.2.4.4.6.8.6.8.2.5..5.2.4.4.6.8.6.8.2 Plus symmetries....2.5..5.2.4.6.8.2.4.6.8 35 Hermite Surface Hump Functions.75.5.25.2.4.8.6.4.75.5.25 - -.5.5 - -.5.5 Plus symmetries.... -. -.6.2.8 -.5.5 -.5..5 -.5.2.4.5.6.8.2.4.6.2. -. -.2 - -.5.8.5.2.5..5.2.4 -.6.8 -.5.2.5.4.6.8 36