CSCE 441 Lecture 8

From Notes
Jump to navigation Jump to search

« previous | Friday, January 31, 2014 | next »


2D Transformations

Coordinates

Depends on choice of origin (0,0) and axes.

Analogous to assembly language:

  • Assembly is a necessary evil for computation
  • But we'd like to think at a higher level

Vector operations

dot product
Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle v \cdot w = \left| v \right| \, \left| w \right| \, \cos{\theta} = v_x \, w_x + v_y \, w_y}
commutative
2D cross product
Rotates by


Types of Transformations

  1. Conformal
    • Preserves angles
    • Translation, rotation, uniform scaling
  2. Affine
    • Represented by matrix multiplication
    • Translation, rotation, general scaling, shear


Translation

Add vector to point :


Uniform Scaling

origin about which to scale

Given point to scale and scaling factor ,

  1. find vector from to :
  2. scale that vector by alpha:
  3. add the vector back to to get final position:

Rearranging the terms gives

Non-Uniform Scaling

Point and vector:

  • origin point for center of scaling
  • direction of scale (assumed unit length)

Given point to scale and a scaling factor ,

  1. find vector from to :
  2. take vector projection of onto :
  3. use projection to find residual vector:
  4. scale the -parallel component of :
  5. add residual vector back in and add to origin point to get final point:

Substituting definitions and rearranging the formula gives


Rotation

Need center of rotation and angle

Given point to rotate about point ,

  1. find vector from to :
  2. set up a "coordinate system" by taking the 2D cross product
  3. using and as new axes, observe that the rotated point is at position
  4. hence the vector from to is given by Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle \cos{\theta} \, \vec{q} + \sin{\theta} \, \vec{q}^\perp}
  5. Add the origin point to get the final position.
Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle \hat{P} = \cos{\theta} \, \vec{q} + \sin{\theta} \, \vec{q}^\perp + O}


Shearing

Point Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle O} and unit vector Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle \vec{v}} .

Given point Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle P} to shear by amount Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle \alpha} ,

  1. compute Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle \vec{q} = P - O}
  2. set up a coordinate system by finding the 2D cross product of Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle \vec{v}} : Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle \vec{v}^\perp = \left\langle -v_y, v_x \right\rangle}
  3. project Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle \vec{q}} onto Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle \vec{v}} and Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle \vec{v}^\perp} to get Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle \vec{q}^\parallel = (\vec{v} \cdot \vec{q}) \vec{v}} and Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle \vec{q}^\perp = (\vec{v}^\perp \cdot \vec{q}) \, \vec{v}^\perp} , respectively.
  4. the shearing vector scales Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle \vec{q}^\parallel} (in the direction of Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle \vec{v}} depending on the magnitude of Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle \vec{q}^\perp} and Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle \alpha} : Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle \vec{q}^\perp + \alpha \, \left| \vec{q}^\perp \right| \, \vec{v}}
  5. Add Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle \vec{q}^\parallel} to get the final position

Plugging in definitions and rearranging gives

Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle \hat{P} = P + \alpha \left( \vec{v}^\perp \cdot \vec{q} \right) \, \vec{v}}


Transformations as Matrices

  • Compact representation of all affine transformations
  • allows multiple transformatinos to be represented as a single matrix
  • requires coordinates Face-sad.svg

Failed to parse (MathML with SVG or PNG fallback (recommended for modern browsers and accessibility tools): Invalid response ("Math extension cannot connect to Restbase.") from server "https://wikimedia.org/api/rest_v1/":): {\displaystyle \hat{p} = M \, p + t}