6) Transformation Types

Common Transformation Types and Their Formulas

Common Transformation Types and Their Formulas

1. Scaling Transformation

Scaling changes the size of an object by multiplying each coordinate by a scale factor. In 2D, a scaling transformation can be represented by the following matrix:

S = [ [sx, 0], [0, sy] ]

Where sx and sy are the scaling factors for the x and y axes, respectively.

Real-World Meaning: Scaling is used in image resizing, zooming in/out on maps, or adjusting the size of objects in computer graphics.

Algorithm Steps:

  • Multiply the x-coordinate by sx.
  • Multiply the y-coordinate by sy.
  • Reconstruct the vector with the new coordinates.

2. Rotation Transformation

Rotation turns an object around a fixed point (usually the origin) by a given angle θ. In 2D, the rotation matrix is:

R(θ) = [ [cos(θ), -sin(θ)], [sin(θ), cos(θ)] ]

This matrix rotates any vector by an angle θ counterclockwise.

Real-World Meaning: Rotation is used in robotics to change orientation, in computer graphics for rotating images, and in physics when switching between reference frames.

Algorithm Steps:

  • Determine the rotation angle θ.
  • Calculate cos(θ) and sin(θ).
  • Multiply the vector by the rotation matrix.

3. Reflection Transformation

Reflection flips an object over a specified line or plane. In 2D, common reflection matrices include:

  • Reflection across the x-axis: Rₓ = [ [1, 0], [0, -1] ]
  • Reflection across the y-axis: R_y = [ [-1, 0], [0, 1] ]
  • Reflection across the line y = x: R₍y=x₎ = [ [0, 1], [1, 0] ]

Real-World Meaning: Reflection is like looking in a mirror. It's used in computer graphics for creating mirror effects and in robotics for reversing directions.

Algorithm Steps:

  • Select the line of reflection.
  • \n
  • Use the appropriate reflection matrix.
  • \n
  • Multiply the vector by this matrix to obtain the reflected vector.

4. Shear Transformation

A shear transformation shifts one coordinate proportional to another. In 2D, there are two types:

  • Horizontal Shear: SH = [ [1, k], [0, 1] ] where k is the shear factor.
  • Vertical Shear: SV = [ [1, 0], [k, 1] ]

Real-World Meaning: Shear is used to create a slanted effect. For example, in design, shear can simulate a sense of motion or create an oblique perspective.

Algorithm Steps:

  • Determine the shear factor k and the direction (horizontal or vertical).
  • \n
  • Use the corresponding shear matrix.
  • \n
  • Multiply the vector by the shear matrix to obtain the sheared vector.

5. (Optional) Translation Transformation

Translation shifts every point of an object by the same amount. Note that translation is not a linear transformation (since it does not preserve the origin), but it is a common affine transformation.

\n

In 2D, translation by (tx, ty) is expressed as:

\n

Using Homogeneous Coordinates: T = [ [1, 0, tx], [0, 1, ty], [0, 0, 1] ]

\n
\n

Real-World Meaning: Translation moves an object without rotating or scaling it, such as moving a window on your desktop or shifting a shape in a graphic design.

\n
\n

Algorithm Steps:

\n
    \n
  • Determine the translation vector (tx, ty).
  • \n
  • If using homogeneous coordinates, represent your vector in 3D form (with a 1 appended).
  • \n
  • Multiply by the translation matrix.
  • \n
\n

Summary

Each transformation type applies a specific matrix to vectors to change their position, orientation, or size. These formulas and algorithms are foundational for tasks in computer graphics, robotics, image processing, and more.

Comments

Popular posts from this blog

4) Vector Spaces

7) Transformation Over Time

2) Prerequisites for understanding vectors