1 / 16

Mathematical Foundations

Mathematical Foundations. Useful math for graphics and games. Mathematical Topics. Lots of math used in graphics and games Various concepts in this course: aliasing coordinate systems homogeneous coordinates matrices quaternions vectors. Vectors.

etoile
Télécharger la présentation

Mathematical Foundations

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 Foundations Useful math for graphics and games

  2. Mathematical Topics • Lots of math used in graphics and games • Various concepts in this course: • aliasing • coordinate systems • homogeneous coordinates • matrices • quaternions • vectors

  3. Vectors • quantity expressing magnitude and direction • often written with respect to a basis • e.g., basis vectors i, j, k • p = ai + bj + ck bj j ai i

  4. Vector magnitude • length of vector == magnitude • p = ai + bj + ck • |p| = sqrt(a*a + b*b + c*c) • Normalized vector: magnitude is 1

  5. Aside: Normal vector • Perpendicular to surface • Specified at vertices in usual geometric models

  6. Vector Notation • “How do you know if something is a vector?” • In code – look at the type! • XNA: Vector2, Vector3, Vector4 • In math (or on slides) – may not have types

  7. Vector Notation → • Has an arrow: x • in bold (sometimes) ax + y • very hard to see, I hate this notation • use domain knowledge • F=ma: which quantities are vectors?

  8. Vector Notation • Often you want to extract components of a vector • If written explicitly, p = ai + bj + ck, can refer to pieces by symbol • If not… • Index like arrays: p[0] • Subscript to show what piece: px

  9. Vector Notation • Special symbol for a unit vector (length 1): ^ • so if we have ŵ, by definition |ŵ| = 1 • Used sometimes in addition to arrow, sometimes alone

  10. Vector Addition • Add components • p = ai + bj + ck • q = si + tj + uk • p + q = (a + s) i + (b + t) j + (c + u) k

  11. Vector Subtraction • p – q = p + (-q) • vector inverse defined: • q = si + tj + uk • -q = (-s)i + (-t)j + (-u)k • p = ai + bj + ck • q = si + tj + uk • p – q = (a – s) i + (b – t) j + (c – u) k

  12. Vector Multiplication • Dot product • magnitude of projection of one vector onto the other • Cross product • only defined for 3-vectors! • vector perpendicular to arguments, with magnitude equal to area of the spanned parallelogram

  13. Dot product • p = ai + bj + ck • q = si + tj + uk • p ∙ q = a*s + b*t + c*u • scalar quantity • p ∙ q = |p| |q| cos θpq

  14. Dot product applications • Basic use: projection of one vector onto another • Lighting: • classic diffuse shading: N∙L • Collisions: • amount of velocity in arbitrary direction • Vector reflection: R = V – 2 V ∙ N ( N/|N|)

  15. Cross product • p = ai + bj + ck • q = si + tj + uk • p x q = (b*u – c*t)i + (c*s – a*u)j + (a*t – b*s)k • new vector perpendicular to both starting vectors • p x q = |p| |q| sin θpq n • Conventionally, right handed coordinate system used

  16. Cross product applications • Obtain surface normal for triangle • use two vectors in plane, cross product is perpendicular • also note, can find winding order (front or back facing) • Calculate area of triangle • In physics, cross product appears regularly • torque = F x d • F = q v x B for charged particle in magnetic field

More Related