#799 – How Transforms Are Combined

Because all transforms in WPF use homogeneous coordinates, combining transforms is accomplished simply by multiplying one or more 3 x 3 matrices together.

For example, suppose that we want to combine a rotation and a translation transform:

                    <RotateTransform Angle="30"/>
                    <TranslateTransform X="5.0" Y="10.0"/>

Recall that the 3 x 3 transformation matrix for rotation looks like:

And recall that the 3 x 3 transformation matrix for translation looks like:


To combine these two transforms together, we multiply the matrices, but in the opposite order from how they are listed:


For the example above, that works out to:


Multiplying any point by this final matrix will result in the point first being rotated and then translated.

In WPF, all of this works automatically behind the scenes.  You just specify in XAML the transforms that you want applied to your user interface elements and WPF calculates and stores the proper transformation matrix.


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

One Response to #799 – How Transforms Are Combined

  1. Pingback: Dew Drop – April 16, 2013 (#1,528) | Alvin Ashcraft's Morning Dew

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 )

Twitter picture

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

Facebook photo

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

Connecting to %s

%d bloggers like this: