CS With NehalCS With Nehal

2D and 3D Geometric Transformation

Create shapes and apply serial transformations such as translation, scaling, rotation, reflection, shear, and custom matrices.

Loading geometric transformation simulator...

About This Simulation

This geometric transformation simulator lets you create 2D and 3D shapes, apply a series of translations, rotations, scalings, reflections, shears or custom matrices, and compare the original shape with the result.

Features

  • Create several shapes in 2D or 3D
  • Translation, scaling, rotation, reflection and shear
  • Custom transformation matrices
  • Serial (composite) transformations applied in order
  • Transformation matrix shown after every step
  • Original and transformed shapes overlaid

Explanation

A geometric transformation changes the position, size, orientation or shape of an object. In computer graphics, transformations are written as matrices in homogeneous coordinates, so several of them can be combined into a single matrix by multiplication.

How it works

  1. Write each point as a column vector in homogeneous coordinates: (x, y, 1) in 2D or (x, y, z, 1) in 3D.
  2. Translation by (tx, ty) adds tx to x and ty to y. Scaling by (sx, sy) multiplies x by sx and y by sy.
  3. Rotation by θ about the origin gives x' = x cos θ − y sin θ and y' = x sin θ + y cos θ.
  4. Reflection flips the sign of a coordinate, and shear adds a multiple of one coordinate to another.
  5. To combine transformations, multiply their matrices. The order matters: the matrix applied first is written on the right. To rotate about a point P, translate P to the origin, rotate, then translate back.

Why it matters

Every game, CAD program and 3D renderer moves, scales and rotates objects with transformation matrices. Composite transformations and homogeneous coordinates are core CSE423 topics.

Frequently Asked Questions

Why are homogeneous coordinates used?

Translation is not a matrix multiplication in normal coordinates. Adding an extra coordinate (w = 1) lets translation, rotation, scaling and shear all be written as matrices, so any sequence of them can be combined into one matrix.

Does the order of transformations matter?

Yes. Matrix multiplication is not commutative, so rotating then translating usually gives a different result from translating then rotating.

How do you rotate an object about an arbitrary point?

Translate the point to the origin, rotate about the origin, then translate back: M = T(px, py) · R(θ) · T(−px, −py).

What is the 2D rotation matrix?

For an anticlockwise rotation by θ: [[cos θ, −sin θ, 0], [sin θ, cos θ, 0], [0, 0, 1]] in homogeneous coordinates.

Topics covered

  • 2D Transformations
  • 3D Transformations
  • Homogeneous Coordinates
  • Transformation Matrices
  • Composite Transformations
  • Rotation About a Point

Tags

  • translation
  • rotation
  • scaling
  • reflection
  • shear
  • transformation matrix

Related Simulations