• date post

23-Feb-2016
• Category

## Documents

• view

18

1

Embed Size (px)

description

Mathematical Topics . Review of some concepts: trigonometry aliasing coordinate systems homogeneous coordinates matrices, quaternions. Vectors. v = ai + bj + ck Describes point or displacement in n-dimensional space Addition, subtraction Multiplication scalar times vector - PowerPoint PPT Presentation

### Transcript of Mathematical Topics

Mathematical Topics

Mathematical Topics Review of some concepts:trigonometryaliasingcoordinate systemshomogeneous coordinates

matrices, quaternions

Vectorsv = ai + bj + ckDescribes point or displacement in n-dimensional spaceAddition, subtractionMultiplicationscalar times vectordot productcross product (only in 3D)Polar Coordinatesrx = r cos y = r sin Trigonometrysin and cos, arcsin, arccos, tan, arctanRelationships between angles and lengths of sides of triangles"Old Hands Always Help One Another"mnemonic for right trianglesAxes form right trianglex = r cos y = r sin rCylindrical Coordinates3D generalization of polar coordinatesrrzx = r cos y = r sin z = zSpherical Coordinatesrrx = r cos sin y = r sin sin z = r cos

in (0,2) in (0,)

Homogeneous CoordinatesIn Cartesian coordinates, a point is (x, y, z)In homogeneous coordinates, (x, y, z, 1)generally, (x, y, z, w)

Homogenization: (x/w, y/w, z/w, 1)The following points are equivalent:(1,2,3,1)(2,4,6,2)(10,20,30,10)Used for translation, revisit when we do perspectiveMatrices2d array of scalarsCan be thought of as "vector of vectors"Encodes a set of linear equations"linear" because each variable has power 1 max

Main operation: multiplicationAddition possible (rarely used in graphics)A + B given by entrywise addition of A[i][j]+B[i][j]Matrix Multiplicationmultiply a matrix and a scalar:s*A given by entrywise multiplication of s*A[i][j]multiply a vector and a matrixresult is a vector of appropriate lengthmultiply two matricesresult is a matrix of appropriate dimensions

Matrix Operation PropertiesA(BC) = (AB)CMultiplication is associativeAB != BA (in general)Multiplication is not commutative

Implications for coordinate transforms:We can gather transforms into a single matrixWe must do elementary transforms in the proper order translate then scale != scale then translateMatrix RotationsWe saw how matrices can encode rotationsEuler: any orientation described by axis of rotation and magnitude of rotation from canonical orientationonly need 3 values (2 for unit axis)Rotation matrix: 9 elements, redundantProblem: composing lots of rotations leads to transformations that are not rotationsnumerical errors inevitableskew, distort the modelQuaternionsMathematical entity made up of a scalar and a vectorq = s+ u, q' = c' + u'q = s + (xi + yj + zk)

q + q': entrywise additionq * q' = s*s' - uu' + (u x u' + s*u' + s' * u)Multiplicative identity: 1 + (0,0,0)Imaginary NumbersRecall complex numbers, a+bi, i = sqrt(-1)Have geometric interpretation: points in 2D

Quaternions: generalized complex numbersImRe4D Complex Numbersi2 = j2 = k2 = -1ij = kji = -ka + bi + cj + dk4D imaginary number, or (s, v) with vector interpretation of i, j, karithmetical properties of quaternions follow from the complex interpretationQuaternions for RotationA rotation is really just an axis and an angleQuaternion as rotationq = (s,v)vector (axis of rotation)scalar (amount of rotation)

Can convert quaternion to rotation matrix, or apply to vector directly (XNA supports both)Quaternion RotationsWritten as (cos(/2), v sin(/2))"Unit quaternion": qq = 1 (if v is a unit vector)Maintain unit quaternion by normalizing vWhy not use s for angle, v for axis directly?lack ability to normalize (trivial objection)difficult to compose rotations (serious)

In mathematics you don't understand things. You just get used to them. (von Neumann)

Composing RotationsWith two rotations, say q1 and q2, we can create a composite rotation q3 = q1*q2XNA: Quaternion.Multiply(q1, q2);

Note: quaternion multiplication not commutative, just as rotations are not commutative (order matters)Inverting RotationsIf you do a rotation of s about axis v...quaternion (s,v)...you can reverse it by rotating by s about vquaternion (-s,v) but AVOID

preferred method is to rotate by s about vsuperior theoretical propertiessame meaning

strange fact: (s, v) = (-s, -v) geometricallyQuaternion RotationArbitrary vector r can be written in quaternion form as (0, r)

To rotate a vector r by about axis v:take q = (cos(/2), v sin(/2) )Let p = (0,r)obtain p' from the quaternion resulting from qpq-1p' = (0, r')r' is the rotated vector rQuaternion PropertiesAdvantages:reasonably compactnormalization enforces legitimate rotationsinterpolation of orientation well-defineduseful for animation, will not use much in this courseDisadvantagesno significant technical disadvantagesrequires 4 coordinates, possible to use 3difficult to understand, develop intuition forAliasingGeneral term nowadays, like "bug": visual defect in computer graphics programProperly, narrow definition: mismatch between sampling rate and underlying signal

Underlying signal: image, texture, synthetic structureSampling rate: one sample per pixel (?)

["Reflection",Nathan Sawaya]Reconstructed signal will not matchreal signal

Moire patternSampling LimitNeed two samples per period of signalIf signal has maximum frequency < B, spatial sampling rate 1/(2B) sufficient

In practice, output sampling (display) fixedNeed to control signal Dont wear stripes on television AntialiasingPixel resolution fixedBut, can use more than one sample per pixel

Antialiasing strategy: compute multiple samples, average themRecent improvements: try not to average across an edgeAntialiasing

Nvidia 2003