Introduction to Computer GraphicsFarhana Bandukwala, PhDLecture 7: Parametric PolynomialsOutline• Explicit vs Implicit representation• Linear approximation• Parametric form• Polynomial cubic curvesExplicit Representation• Explicit form: value of variable in terms of other y=f(x)• x is independent and y is dependent • Inverse function: x=g(y)• For a given curve, no guarantee of explicit representation• Line: y=mx+h (not for vertical lines)• Circle: y=+/-sqrt(r2-x2)Implicit Representation• f(x,y)=0• Line: ax+by+c=0• Circle at origin: x2+y2+r2=0• Divides 2-D space into points on or off curve• Intersections of two curve have to satisfy both equationsLinear approximationConnected line segmentsGood linear approximation needs several points at high curvature regionsParametric form• Each spatial variable expressed in terms of an independent variable• x = x(u) and y = y(u)• Locus of points p=[x(u) y(u)] for u=[umin,umax]• Derivative (or velocity) [dx(u)/du dy(u)/du]Parametric polynomial curves• Functions x(u) and y(u) are polynomials in terms of u• A curve of degree n is p(u)=[Σukcxk,Σukcyk] for k=1..n• Alternatively p(u)=Σukckwhere ck=[cxk, cyk]Design criteria for curves• Local control of shape: simple curve segments joined together provide better shape control• Continuity and smoothness: touching segments and smooth transition between segments• Derivative which can be evaluated: to evaluate smoothness• Stability: smooth changing of parameters leads to intuitive changes in curve segment• Ease of renderingInterpolate vs approximate• Given set of data points: interpolating curve passes through each point w/max degrees of freedom• Approximating curve passes as close as possible while maintaining minimum degrees of freedomInterpolationApproximationParametric cubic curves• High degree: complex curve w/many parameters• Low degree: not enough control• Cubic curves are preferred as good balance• px(u)=cx0+cx1u+cx2u2+cx3u3 (x component)1 u u2u3cx0cx1cx2cx3Matrix form: px(u)=uTcInterpolation• Problem: given 4 2D points, find interpolating curve• Alternatively: find coefficients c• Suppose points are at u=0,1/3,2/3,1(x0,y0)(x1,y1)(x2,y2)(x3,y3)px(0) = cx0px(1/3) = cx0+ cx1(1/3) + cx2(1/3)2+ cx3(1/3)3px(2/3) = cx0+ cx1(2/3) + cx2(2/3)2+ cx3(2/3)3px(1) = cx0+ cx1(1) + cx2(1)2+ cx3(1)3=x0x1x2x31 0 0 01 1/3 (1/3)2(1/3)31 2/3 (2/3)2(2/3)31 1 1 1cx0cx1cx2cx3Blending (basis) functionP(u) = [px(u) py(u)] = uTC = uTMGu3u2u 0m11m12m13m14m21m22m23m24m31m32m33m34m41m42m43m44G0xG0yG1xG1yG2xG2yG3xG3yBasis matrixGeometry matrixmij= bj(ui) where bj(u) is a blending or basis functionx0x1x2x3=1 0 0 01 1/3 (1/3)2(1/3)31 2/3 (2/3)2(2/3)31 1 1
View Full Document