vector

  • Usually denoted as a⃗\vec{a}a or a;
  • AB ⃗ = B – A \ vec {B} = B – AAB = B – A;
  • There are two important properties: direction and length;
  • There is no absolute starting position;
  • The length of the vector to ∣ ∣ a ⃗ ∣ ∣ | | \ vec {a} | | ∣ ∣ a ∣ ∣;
  • Unit vector:
    • The length of 1

    • a ^ = a a \hat{a}=\frac{\vec{a}}{||\vec{a}||}
    • Used to indicate direction

Add vectors

  • Geometry: parallelogram rule and triangle rule
  • Arithmetic: adding coordinates

Cartesian coordinates

  • Use X and Y to represent vectors (usually orthogonal units)


    A = ( x y ) A=\begin{pmatrix} x \\ y \end{pmatrix}

    A T = ( x . y ) A^T = (x, y)

    A = x 2 + y 2 ||A|| = \sqrt{x^2 + y^2}

Vector multiplication

  • Dot product


a b = a b c o s Theta. \vec{a} \cdot \vec{b} = ||\vec{a}||||\vec{b}||cos\theta

c o s Theta. = a b a b cos\theta = \frac{\vec{a} \cdot \vec{b}}{||\vec{a}||||\vec{b}||}

For unit vectors


c o s Theta. = a ^ b ^ cos\theta = \hat{a} \cdot \hat{b}
  • The nature of the

a b = b a \vec{a} \cdot \vec{b} = \vec{b} \cdot \vec{a}

a ( b + c ) = a b + a c \vec{a} \cdot (\vec{b} + \vec{c}) = \vec{a} \cdot \vec{b} + \vec{a} \cdot \vec{c}

( k a ) b = a ( k b ) = k ( a b ) (k\vec{a}) \cdot \vec{b} = \vec{a} \cdot (k\vec{b}) = k(\vec{a} \cdot \vec{b})

In Cartesian coordinates

  • You multiply each element and you add them

-2D


a b = ( x a y a ) ( x b y b ) = x a x b + y a y b \vec{a} \cdot \vec{b} = \begin{pmatrix} x_a \\ y_a \end{pmatrix} \cdot \begin{pmatrix} x_b \\ y_b \end{pmatrix} = x_ax_b + y_ay_b

-3D


a b = ( x a y a z a ) ( x b y b z b ) = x a x b + y a y b + z a z b \vec{a} \cdot \vec{b} = \begin{pmatrix} x_a \\ y_a \\ z_a \end{pmatrix} \cdot \begin{pmatrix} x_b \\ y_b \\ z_b \end{pmatrix} = x_ax_b + y_ay_b + z_az_b

Application of dot product in graphics

  • The Angle between two vectors (for example, the cosine of the Angle between the light source and the plane)

  • The projection of one vector onto another vector

  • Measure the proximity of the two directions

  • I decompose a vector

  • Decide before and after

projection

  • B ⃗ \ coming vec {b} _ {\ perp} b: coming b ⃗ \ vec {b} b in a ⃗ \ vec {a} a projection

    • B ⃗ perp \vec{b}_{\perp}b perp \ a^\hat{a}a^


      b an = k a ^ \vec{b}_{\perp} = k\hat{a}
    • The size of the k


      k = b an = b c o s Theta. k=||\vec{b}_{\perp}||=||\vec{b}||cos\theta

Cross product of vectors

  • Cross product is orthogonal to two initial vectors
  • Direction through the right hand spiral theorem
  • It’s very useful in setting up coordinates

  • In Cartesian coordinates

Application of cross product in graphics

  • Decide left and right
  • Decide on the inside and out

Orthonormal Coordinate Frames

matrix

  • 2 d array

  • In graphics, used to indicate transformations.

    Translation, rotation, shear, scale

  • M ×nm \times nm×n = m rows, n columns


    ( 1 3 5 2 0 4 ) \begin{pmatrix} 1 & 3 \\ 5 & 2 \\ 0 & 4 \end{pmatrix}
  • Adding and multiplying a scalar is adding or multiplying a scalar element by element

Matrix multiplication

  • (M×NM \times NM×N)(N×PN \times PN×P) = (M×PM \times PM×P)

  • When you multiply, the elements (I, j), row I from A, column j from B

  • Properties:

    • No commutative law

    • Other properties

transpose

  • The nature of the


    ( A B ) T = B T A T (AB)^T = B^TA^T

Yan Lingqi << Introduction to Modern Computer Graphics >>