table of contents

2d transformations

2d transformation matrices for low-level computer graphics2023-06-02

we use a vector to represent a point in 2d space.

a general form of linear transformations (or more precisely, affine transformations) in can be written as:

or or, in matrix form, using homogeneous coordinates: matrices allow arbitrary linear transformations to be displayed in a consistent format, suitable for computation.

2d translation

given a point , we wanna reposition it with the translation distance this is an affine transformation, we deduce an affine transformation matrix:

2d rotation about the origin

a rotation about the origin by angle can be done with the matrix:

2d scaling

scaling is just multiplying the variables by some constants, it is defined using the hadamard product of the point by the scaling vector we deduce the transformation matrix: using homogeneous coordinates:

mapping a grid onto another

this is a special case of the formula for linearly mapping an interval onto another, where the number of dimensions is 2.

mapping the point from the intervals , respectively, to the intervals , respectively: