#7: Cubic CurvesOutline for todayGraphics pipeline transformationsHow do we get C-1?Inverse of a translationInverse of a scaleInverse of a rotationInverses of compositionComposing with inverses, pictoriallyModel-to-Camera transformThe look-at transformationC-1 from a,b,c,d columnsSlide 13Usefulness of curves in modelingSlide 15Slide 16Usefulness of curves in animationSlide 18How to represent curvesInterpolating SplinesApproximating SplinesWhat is a curve, anyway? The tangent to the curvePolynomial FunctionsPoint-valued Polynomials (Curves)How much do you need to specify?Linear InterpolationLinear interpolationLinear interpolation as weighted averageLinear interpolation as polynomialLinear interpolation in matrix formLinear Interpolation: tangentSlide 33Bézier CurvesCubic Bézier CurveBézier Curve FormulationBézier Curvede Casteljau AlgorithmSlide 39Slide 40Slide 41Slide 42de Casteljau algorihmRecursive Linear InterpolationExpand the LerpsWeighted average of control pointsBézier using Bernstein PolynomialsGeneral Bernstein PolynomialsGeneral Bézier using Bernstein PolynomialsConvex Hull PropertyCubic Equation FormAside: linear combinations of pointsCubic Equation, vector notationCubic Matrix FormSlide 55Matrix FormTangentSlide 58Transforming Bézier curvesDrawing Bézier CurvesUniform SamplingAdaptive SamplingRecursive Subdivisionde Casteljau subdivisionAdaptive subdivision algorithm:Done#7: Cubic CurvesCSE167: Computer GraphicsInstructor: Ronen BarzelUCSD, Winter 20062Outline for todayInverses of TransformsCurves overviewBézier curves3Graphics pipeline transformationsRemember the series of transforms in the graphics pipe:M - model: places object in world spaceC - camera: places camera in world spaceP - projection: from camera space to normalized view spaceD - viewport: remaps to image coordinatesAnd remember about C:handy for positioning the camera as a modelbackwards for the pipeline:• we need to get from world space to camera spaceSo we need to use C-1You’ll need it for project 4: OpenGL wants you to load C-1 as the base of the MODELVIEW stack4How do we get C-1?Could construct C, and use a matrix-inverse routineWould work.But relatively slow. And we didn’t give you one :)Instead, let’s construct C-1 directlybased on how we constructed Cbased on shortcuts and rules for affine transforms5Inverse of a translationTranslate back, i.e., negate the translation vectorEasy to verify: T (rv) =1 0 0 vx0 1 0 vy0 0 1 vz0 0 0 1⎡⎣⎢⎢⎢⎢⎤⎦⎥⎥⎥⎥T−1(rv) =T(−rv) =1 0 0 −vx0 1 0 −vy0 0 1 −vz0 0 0 1⎡⎣⎢⎢⎢⎢⎤⎦⎥⎥⎥⎥ T(−rv)T(rv)=1 0 0 −vx0 1 0 −vy0 0 1 −vz0 0 0 1⎡⎣⎢⎢⎢⎢⎤⎦⎥⎥⎥⎥1 0 0 vx0 1 0 vy0 0 1 vz0 0 0 1⎡⎣⎢⎢⎢⎢⎤⎦⎥⎥⎥⎥=1 0 0 vx−vx0 1 0 vy−vy0 0 1 vz−vz0 0 0 1⎡⎣⎢⎢⎢⎢⎤⎦⎥⎥⎥⎥=1 0 0 00 1 0 00 0 1 00 0 0 1⎡⎣⎢⎢⎢⎢⎤⎦⎥⎥⎥⎥=I6Inverse of a scaleScale by the inversesEasy to verify:S(sx, sy, sz) =sx0 0 00 sy0 00 0 sz00 0 0 1⎡⎣⎢⎢⎢⎢⎤⎦⎥⎥⎥⎥S−1(sx,sy,sz) =S(1sx,1sy,1sz) =1 sx0 0 00 1 sy0 00 0 1 sz00 0 0 1⎡⎣⎢⎢⎢⎢⎤⎦⎥⎥⎥⎥S(1sx,1sy,1sz)S(sx, sy, sz)=1 sx0 0 00 1 sy0 00 0 1 sz00 0 0 1⎡⎣⎢⎢⎢⎢⎤⎦⎥⎥⎥⎥sx0 0 00 sy0 00 0 sz00 0 0 1⎡⎣⎢⎢⎢⎢⎤⎦⎥⎥⎥⎥=sxsx0 0 00 sysy0 00 0 szsz00 0 0 1⎡⎣⎢⎢⎢⎢⎤⎦⎥⎥⎥⎥=1 0 0 00 1 0 00 0 1 00 0 0 1⎡⎣⎢⎢⎢⎢⎤⎦⎥⎥⎥⎥=I7Inverse of a rotation Rotate about the same axis, with the oppose angle:Inverse of a rotation is the transpose: •Columns of a rotation matrix are orthonormal•ATA produces all columns’ dot-product combinations as matrix•Dot product of a column with itself = 1 (on the diagonal)•Dot product of a column with any other column = 0 (off the diagonal) R−1(ra,θ) =R(ra,−θ)For example:Rz(θ) =cos(θ) −sin(θ) 0 0sin(θ) cos(θ) 0 00 0 1 00 0 0 1⎡⎣⎢⎢⎢⎢⎤⎦⎥⎥⎥⎥Rz−1(θ) =Rz(−θ) =cos(θ) −sin(−θ) 0 0sin(−θ) cos(θ) 0 00 0 1 00 0 0 1⎡⎣⎢⎢⎢⎢⎤⎦⎥⎥⎥⎥=cos(θ) sin(θ) 0 0−sin(θ) cos(θ) 0 00 0 1 00 0 0 1⎡⎣⎢⎢⎢⎢⎤⎦⎥⎥⎥⎥=RzT(θ) R−1(ra,θ) =RT(ra,θ)8Inverses of compositionIf you have a series of transforms composed together M =ABCDTo invert, compose inverses in the reverse orderM−1= D−1C−1B−1A−1Easy to verify:M−1M = (D−1C−1B−1A−1)(ABCD)= D−1C−1B−1A−1AI1 2 3BCD= D−1C−1B−1BI{CD= D−1C−1CI{D= D−1D= I9Composing with inverses, pictoriallyTo go from one space to another, compose along arrowsBackwards along arrow: use inverse transformQuickTime™ and aTIFF (LZW) decompressorare needed to see this picture.Lamp in world coords = Mtable 1Mtop1MlampPlant in Tabletop1 coords = Mtop1−1Mtable1−1Mtable2Mtop2Mplant10Model-to-Camera transformQuickTime™ and aTIFF (Uncompressed) decompressorare needed to see this picture.xyzQuickTime™ and aTIFF (Uncompressed) decompressorare needed to see this picture.Camera SpaceCamera-to-worldCQuickTime™ and aTIFF (LZW) decompressorare needed to see this picture.Model-to-Camera = C-1M11The look-at transformationRemember, we constructed C using the look-at idiom: Given: eye point e, target point t, and up vector ruCons truct: columns of camera matrix Cd =erc=e−te−tra=ru×rcru×rcrb=rc×raImportant: ra,rb,rcare orthonormal12C-1 from a,b,c,d columns • If we construct a transform using ra,rb,rc,rd columns, it's the s ame as a composition.• First rotate/scale using ra,rb,rc, then translate by rd:C =axbxcxdxaybycydyazbzczdz0 0 0 1⎡⎣⎢⎢⎢⎢⎤⎦⎥⎥⎥⎥=1 0 0 dx0 1 0 dy0 0 1 dz0 0 0 1⎡⎣⎢⎢⎢⎢⎤⎦⎥⎥⎥⎥axbxcx0aybycy0azbzcz00 0 0 1⎡⎣⎢⎢⎢⎢⎤⎦⎥⎥⎥⎥= T(rd)M• If ra,rb,rc a re orthonormal, they define a pure rotation:C = T(rd)R• To take the invers e:C−1= T(rd)R(
View Full Document