Transformations on the plane

Written by Paul Bourke
January 1987


The following describes the 2d transformation of a point on a plane

P = ( x , y ) -> P' = ( x' , y' )

Translation

A translation (shift) by Tx in the x direction and Ty in the y direction is

x' = x + Tx
y' = y + Ty

Scaling

A scaling by Sx in the x direction and Sy in the y directions about the origin is

x' = Sx x
y' = Sy y

If Sx and Sy are not equal this results in a stretching along the axis of the larger scale factor.
To scale about a particular point, first translate to the origin, scale, and translate back to the original position. For example, to scale about the point (x0,y0)

x' = x0 + Sx ( x - x0 )
y' = y0 + Sy ( y - y0 )

Rotation

Rotation about the origin by an angle A in a clockwise direction is

x' = x cos(A) + y sin(A)
y' = y cos(A) - x sin(A)

To rotate about a particular point apply the same technique as described for scaling, translate the coordinate system to the origin, rotate, and the translate back.

Reflection

Reflection about the x axis

x' = x
y' = - y

Reflection about the y axis

x' = - x
y' = y

Reflections about an arbitrary line involve possibly a translation so that a point on the line passes through the origin, a rotation of the line to align it with one of the axis, a reflection, inverse rotation and inverse translation.

Shear

A shear by SHx in the x axis is accomplished with

x' = SHx x
y' = y

A shear by SHy in the y axis is acomplished with

x' = x
y' = SHy y