1 / 27

Mathematical Topics

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

emmet
Download Presentation

Mathematical Topics

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Mathematical Topics • Review of some concepts: • trigonometry • aliasing • coordinate systems • homogeneous coordinates • matrices, quaternions

  2. Vectors • v = ai + bj + ck • Describes point or displacement in n-dimensional space • Addition, subtraction • Multiplication • scalar times vector • dot product • cross product (only in 3D)

  3. Polar Coordinates r θ x = r cosθ y = r sin θ

  4. Trigonometry • sin and cos, arcsin, arccos, tan, arctan • Relationships between angles and lengths of sides of triangles • "Old Hands Always Help One Another" • mnemonic for right triangles • Axes form right triangle r x = r cosθ y = r sin θ θ

  5. Cylindrical Coordinates 3D generalization of polar coordinates r r θ θ z x = r cosθ y = r sin θ z = z

  6. Spherical Coordinates θ φ r r θ x = r cosθ sin φ y = r sin θ sin φ z = r cosφ θ in (0,2π) φ in (0,π)

  7. Homogeneous Coordinates • In 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 perspective

  8. Matrices • 2d array of scalars • Can be thought of as "vector of vectors" • Encodes a set of linear equations • "linear" because each variable has power 1 max • Main operation: multiplication • Addition possible (rarely used in graphics) • A + B given by entrywise addition of A[i][j]+B[i][j]

  9. Matrix Multiplication • multiply a matrix and a scalar: • s*A given by entrywise multiplication of s*A[i][j] • multiply a vector and a matrix • result is a vector of appropriate length • multiply two matrices • result is a matrix of appropriate dimensions

  10. Matrix Operation Properties • A(BC) = (AB)C • Multiplication is associative • AB != BA (in general) • Multiplication is not commutative • Implications for coordinate transforms: • We can gather transforms into a single matrix • We must do elementary transforms in the proper order – translate then scale != scale then translate

  11. Matrix Rotations • We saw how matrices can encode rotations • Euler: any orientation described by axis of rotation and magnitude of rotation from canonical orientation • only need 3 values (2 for unit axis) • Rotation matrix: 9 elements, redundant • Problem: composing lots of rotations leads to transformations that are not rotations • numerical errors inevitable • skew, distort the model

  12. Quaternions Mathematical entity made up of a scalar and a vector q = s+ u, q' = c' + u' q = s + (xi + yj + zk) q + q': entrywise addition q * q' = s*s' - u∙u' + (u x u' + s*u' + s' * u) Multiplicative identity: 1 + (0,0,0)

  13. Imaginary Numbers Recall complex numbers, a+bi, i = sqrt(-1) Have geometric interpretation: points in 2D Quaternions: generalized complex numbers Im Re

  14. 4D Complex Numbers • i2 = j2 = k2 = -1 • ij = k • ji = -k • a + bi + cj + dk • 4D imaginary number, or (s, v) with vector interpretation of i, j, k • arithmetical properties of quaternions follow from the complex interpretation

  15. Quaternions for Rotation • A rotation is really just an axis and an angle • Quaternion as rotation • q = (s,v) • vector (axis of rotation) • scalar (amount of rotation) • Can convert quaternion to rotation matrix, or apply to vector directly (XNA supports both)

  16. Quaternion Rotations • Written as (cos(θ/2), v sin(θ/2)) • "Unit quaternion": q∙q = 1 (if v is a unit vector) • Maintain unit quaternion by normalizing v • Why 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)

  17. Composing Rotations With two rotations, say q1 and q2, we can create a composite rotation q3 = q1*q2 XNA: Quaternion.Multiply(q1, q2); Note: quaternion multiplication not commutative, just as rotations are not commutative (order matters)

  18. Inverting Rotations • If you do a rotation of s about axis v... • quaternion (s,v) • ...you can reverse it by rotating by –s about v • quaternion (-s,v) – but AVOID • preferred method is to rotate by s about –v • superior theoretical properties • same meaning • strange fact: (s, v) = (-s, -v) geometrically

  19. Quaternion Rotation • Arbitrary 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-1 • p' = (0, r') • r' is the rotated vector r

  20. Quaternion Properties • Advantages: • reasonably compact • normalization enforces legitimate rotations • interpolation of orientation well-defined • useful for animation, will not use much in this course • Disadvantages • no significant technical disadvantages • requires 4 coordinates, possible to use 3 • difficult to understand, develop intuition for

  21. Aliasing • General term nowadays, like "bug": • visual defect in computer graphics program • Properly, narrow definition: mismatch between sampling rate and underlying signal • Underlying signal: image, texture, synthetic structure • Sampling rate: one sample per pixel (?)

  22. ["Reflection", Nathan Sawaya]

  23. Reconstructed signal will not match real signal

  24. Moire pattern

  25. Sampling Limit Need two samples per period of signal If signal has maximum frequency < B, spatial sampling rate 1/(2B) sufficient In practice, output sampling (display) fixed Need to control signal “Don’t wear stripes on television”

  26. Antialiasing Pixel resolution fixed But, can use more than one sample per pixel Antialiasing strategy: compute multiple samples, average them Recent improvements: try not to average across an edge

  27. Antialiasing Nvidia 2003

More Related