ReviewofBasicMathfor ComputerGraphics CENG315–ComputerGraphics M.AbdullahBulbul Sets m∈S n∈S x∈T y∈T z∈T m n setS AxB:allpossiblepairs(a,b)wherea∈A,b∈B A2=S,S SxT={(m,x),(m,y),(m,z), (n,x),(n,y),(n,z)} S2={(m,m),(m,n),(n,m),(n,n)} x y z setT Usefulsets Trigonometry • Radians • Angle=lengthoftheunitcirclethatiscutbythetwodirecOons. • Angles • degrees=radians*180/π • Pythagoreantheorem • Righttriangle • • • • • • sin(x)=? cos(x)=? tan(x)=? cot(x)=? csc(x)=1/sin(x) sec(x)=1/cos(x) • Unitcircle Usefulidentities • sin(-x)=-sin(x) • cos(-x)=cos(x) • tan(-x)=-tan(x) • sin(π/2-x)=cos(x) • cos(π/2-x)=sin(x) • tan(π/2-x)=cot(x) Usefulidentities • PythagoreanidenOOes: • sin2(x)+cos2(x)=? • sec2(x)–tan2(x)=? • sin(a+b)=sin(a)cos(b)+sin(b)cos(a) • sin(2a)=2sin(a)cos(a) • sin(a-b)=sin(a)cos(b)-sin(b)cos(a) • cos(a+b)=cos(a)cos(b)–sin(a)sin(b) • cos(2a)=cos2(a)–sin2(a) • cos(a-b)=cos(a)cos(b)+sin(a)sin(b) Vectors • Avector:alength&adirecOon a • Usuallywri\enasa(bold) • AbsoluteposiOonisnotimportant • Magnitude=||a|| • Usedtostoreoffsets,displacements,locaOons • TodefinealocaOonyouneedanorigin Vectoraddition a+b b a commutaOve:a+b=b+a a b b+a Unaryminusandsubtraction a -a • ChecksubtracOononaparallelogram 2DCartesianSpace • a= xa ya • aT= xaya 4x • a= 3y 2DCartesianSpace • A2Dvectorcanbewri\enasacombinaOonofanytwononzerovectorsthatarenotparallel • Linearindependence • c=k1a+k2b • Exercise Linearindependence Linearindependence&basis • Anytwoparallelsthatarenotparallelformsa2Dbasis. • CangoanywherebyacombinaOonofthem • Unitvectorsarespecialcase • Orthonormalbasis • Simplifiesthings VectorMultiplication • Dot(scalar)product • Crossproduct Dot(scalar)product b • a.b=b.a=? x a Dot(scalar)product b x • a.b=b.a=? • =||a||||b||cos(x) a • DistribuOve:a.(b+c)=a.b+a.c • x=cos-1(a.b/(||a||||b||))(mostcommonuse) Dotproductincartesiancoordinates xa xb • a.b=.=? ya yb Dotproductincartesiancoordinates xa xb • a.b=.=? ya (Fairlysimple) =xaxb+yayb yb Commonusesofdotproduct • Findanglebetweentwovectors(lightandsurfaceexample) • ProjecOonofavectoronanotherone • Computedeasilyoncartesiancomponents Projectionofavectoronanother • ba b x ba a Projectionofavectoronanother • ba b x ba • inferit(5minutes) a Crossproduct • Theresultofadotproductwasscalar • Theresultofacrossproductisavector • Perpendiculartobothvectors • Length: • Areaoftheparallelogram • ||a×b||=||a||||b||sin(ϕ) • DirecOon: • Righthandrule Crossproduct • X×Y=+Z • Y×X=-Z • Y×Z=+X • Z×Y=-X • a×b=-b×a • a×a=? • a×(b+c)=a×b+a×c • Z×X=+Y • X×Z=-Y • Be\erontheboard CrossproductonCartesianspace xyz aybz–azby • a×b== axayaz azbx–axbz bxbybz axby–aybx Orthonormalbases • Managingcoordinatesystemsisimportant! • Orthonormalbasesisthekey. In2D:uandvformanorthonormalbasisiftheyare • Eachofthemareunitlength ||u||=||v||=1 • Orthogonaltoeachother u.v=0 Orthonormalbases In3D:u,vandwformanorthonormalbasisiftheyare • Allofunitlength ||u||=||v||=||w||=1 • Anypairofthemareorthogonaltoeachother u.v=0,v.w=0,u.w=0 • Righthandedifw=u×v • Otherwiselenhanded • Thereareinfinitelymanyorthonormalbases Orthonormalbases In3D:u,vandwformanorthonormalbasisiftheyare • Allofunitlength ||u||=||v||=||w||=1 • Anypairofthemareorthogonaltoeachother u.v=0,v.w=0,u.w=0 • Righthandedifw=u×v • Otherwiselenhanded • Thereareinfinitelymanyorthonormalbases Canonicalorthonormalbasis • Cartesiancanonicalorthonormalbasis • x=(1,0,0) • y=(0,1,0) • z=(0,0,1) Constructinganorthonormalbasis givenasinglevector • Easierontheboard Matrix • Whatisamatrix • IdenOtymatrix • Transpose • Determinant • MatrixvectormulOplicaOon • MatrixmatrixmulOplicaOon
© Copyright 2025 Paperzz