#796 – WPF Transforms Use Homogeneous Coordinates

We saw that we can perform scale and rotation transforms on points in 2D by multiplying a 2 x 2 transformation by a 2 x 1 matrix representing a point.  A translation transform, however, could not be accomplished using a 2 x 2 matrix.  Instead, we multiply a 3 x 3 matrix by a 3 x 1 matrix that represents the 2D point.


In WPF, all 2D transforms are accomplished using a 3 x 3 transformation matrix and a 3 x 1 point matrix.  The 3 x 1 matrix contains the x and y components of the point in the first two rows and a value of 1 as the third row.  This is done so that we can easily combine scale, rotate and translation transforms, since they all use matrices of the same dimensions.

In representing a 2D point using a 3 x 1 matrix, WPF is making us of homogeneous coordinates, which involves adding a third dimension, represented by the third row of the point matrix.


About Sean
Software developer in the Twin Cities area, passionate about software development and sailing.

One Response to #796 – WPF Transforms Use Homogeneous Coordinates

  1. Pingback: #803 – Specifying an Arbitrary Transform with a MatrixTransform | 2,000 Things You Should Know About WPF

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: