6 Composite 2D Transformations

T. Raghuveera

epgp books

 

 

 

Objectives:

  • Understand composite transformations and their representation in homogeneous coordinates.
  • Learn how to break up a complex transformation into a series of simple transformations and thus deal with complexity.

 

Discussion:

 

Let’s recollect discussion on Basic transformations, Translation, Rotation and scalingfrom the previous module(5th module). All the three basic transformations can be represented in a common format using one matrix multiplication and one matrix addition. Using homogeneous coordinate representation, we can combine the two (multiplication and addition in 2D Cartesian form) into a single 3×3 homogeneous matrix. Given below are the homogeneous representations of the three basic transformations assuming that the transformations are performed with respect to origin. Now to perform a transformation on an object simply multiply the corresponding homogeneous transformation matrix with the coordinates that define the object, and get the new coordinates.

 

Observe the elements of the third column in the above three matrices for Translation, Rotation and Scaling. We can notice that for Translation the third column has the elements (tx,ty) which are non-zero, while the elements of the third column for rotation and scaling transformations are zeros (leaving 1, as 1 being the homogeneous coordinate). The third column elements will be non-zeros for Rotation and Scaling, if they are performed with respect to some other point in space other than origin. Those elements for Rotation and Scaling will be the contents of the matrix Mr and Ms, as discussed in the previous module (Module 5).

 

Composition:

 

As we know from previous discussions that due to representations in homogeneous coordinates, a series of transformations can be simply represented as matrix multiplications,acomposite is then obtained. The composite can then be used to compute final coordinates straight away given the initial coordinates.

 

Let’s understand composite transformations by performing multiple transformations in succession, to start with consider the following cases

 

Case -1:Two successive translations,

Case – 2:Two successive rotations,

Case – 3: Two successive scaling operations

 

Case-1:Two Successive translations

 

Let T1 (tx1, ty1) and T2 (tx2,ty2) be two translations applied on a point P(x,y) in succession. Find the composite transformation matrix?

 

Sol: First T1 is applied on P as

T1 (tx1, ty1). {P}

Then T2 is applied on the resultant position i.e.

 

P’=T2 (tx2, ty2).{T1 (tx1, ty1).{P}}

 

It is evident from this equation that, the transformations applied in the order T1, T2 are reversed. This is because first T1 is applied on P, so P is multiplied to the right of T1. The resultant matrix is a new position, which is then multiplied to the right of T2, to get the final position. It makes no difference if T2 and T1 are first multiplied and the resultant 3×3 matrix (called composite) is multiplied with P on the right. So we can rearrange the braces as below (which does not alter the end result)

 

P’={T2 (tx2, ty2).T1 (tx1, ty1)}.{P}

 

Converting the above notation into matrix form we have

 

Thus we can conclude that two successive translations are additive (as is evident from the third column elements in the composite matrix).The notation for this is given below where T being the composite transformation matrix, representing the complex transformation of two successive translations.

P’=T (tx2+tx1, ty2+ty1).{P}

 

Case-2:Two Successive rotations

 

Let R1 (θ1) and R2 (θ2) be two rotations applied on a point P(x,y) in succession, with respect to origin.. Find the composite transformation matrix?

 

Sol: First R1 is applied on P as

R1 (θ1). {P}

Then R2 is applied on the resultant position i.e.

 

P’= {R2(θ2).R1(θ1)}.{P}

 

 

Thus we can conclude that two successive rotations are additive(as evident from the composite matrix) which can be written in notation as

 

P’=R (θ2+θ1).{P}

 

where R is the composite matrix representing the complex transformation,two successive rotations.

 

Case-3:Two Successive scaling operations

 

Let S1 (sx1,sy1) and S2 (sx2, sy2) be two rotations applied on a point P(x,y) in succession, with respect to origin.. Find the composite transformation matrix?

 

Sol: First S1 is applied on P as

S2 (sx1,sy1). {P}

Then S2 is applied on the resultant position i.e.

 

P’= {S2 (sx2, sy2) . S1 (sx1,sy1) )}.{P}

 

Thus we can conclude that two successive scaling operations are multiplicative (as evident from the composite matrix) which can be written in notation as

 

P’=S (sx2.sx1, sy2.sy1).{P}

 

where S is the composite matrix representing the complex transformation, two successive scalings.

 

Example-1:General Pivot Point Rotation:

 

 

Let’s consider an example for composite transformations through, general pivot point rotation. Let’s assume the case of rotation about a pivot that is any point in space other than origin. We can treat this as a complex transformation. A complex transformation can be broken up into a series of simple / basic transformations and simply multiply them, to get the composite matrix that represents the complex transformation.

 

Imagine a randomly chosen pivot point,say, at (xr,yr) as shown in the figure above. Assume an object to be rotated about the chosen pivot point. The sequence of steps to break the complex transformation of ‘General Pivot Point Rotation’ is given below

 

Step-1: Pivot point translated such that it is at origin.

 

T(-xr,-yr)

 

Step-2: Rotation with respect to origin performed.

 

R(θ)

 

Step-3: Pivot point translated back to its original position.

 

T(xr, yr)

 

The above three steps are to performed in that order. When we convert that into notation form, we have to put the steps in the reverse order (as understood from previous discussion in this module)

 

P’= {T(xr, yr).R(θ).T(-xr,-yr)}.{P}

 

Converting the above notation to matrix form we have

 

 

After finding the composite we have

 

From the composite matrix it is understood that rotation about any general point in space would result in two non-zero elements of the third column

 

xr(1-cosθ)+yr sinθ,

yr(1-cosθ)-xr sinθ

 

The above two elements are the elements of the Matrix Mr (refer to discussion in module 5), which we assumed earlier as some non-zero elements, and now derived.

 

 

Example-2: General fixed Point Scaling:

 

 

Let’s consider another example for composite transformations through, general fixed point scaling. Let’s assume the case of scalingwith respect to a fixedpoint that is any point in space other than origin. We can treat this as a complex transformation. A complex transformation can be broken up into a series of simple / basic transformations and simply multiply them, to get the composite matrix that represents the complex transformation.

 

Imagine a randomly chosen fixed point, say, at (xf,yf) as shown in the figure above. Assume an object to be scaled about the chosen fixed point. The sequence of steps to break the complex transformation of ‘General fixed Point scaling’ is given below

 

Step-1: Fixed point translated such that it is at origin.

T(-xf,-yf)

 

Step-2: Scaling with respect to origin performed.

S(sx,sy)

 

Step-3: Fixed point translated back to its original position.

T(xf, yf)

 

The above three steps are to performed in that order. When we convert that into notation form, we have to put the steps in the reverse order (as understood from previous discussion in this module)

 

P’= {T(xf,yf).S(sx,sy).T(-xf,-yf)}.{P}

 

Converting the above notation to matrix form we have

 

 

 

 

After finding the composite we have

 

From the composite matrix it is understood that rotation about any general point in space would result in two non-zero elements of the third columnare

 

xf(1-sx)

yf(1-sy)

 

The above two elements are the elements of the Matrix Ms (refer to discussion in module 5), which we assumed earlier as some non-zero elements), and now derived.

 

 

Example-3: General scaling directions

 

Let’s consider another interesting example, ‘General Scaling Directions’, which can understood as, scaling performed on an object along two mutually perpendicular directions other than the standard X and Y directions of the coordinate system, i.e., the object is stretched or squeezed along directions say S1 and S2 which are other than X and Y directions. If an object like a standard square positioned at origin is stretched along its diagonal the shape gets destroyed and it might turn out to be a rhombus or other.

 

As an example, Consider a standard unit square (A unit square whose sides are aligned with the coordinate axes and one of its vertices is (0, 0)) at origin, as shown in the figure below. Scale it along scaling directions such that S1=1 and S2=2 (where S1 and S2 are scaling factors alongS1and S2directions respectively.

 

We can treat this as a complex transformation. A complex transformation can be broken up into a series of simple / basic transformations and simply multiply them, to get the composite matrix that represents the complex transformation.

 

The sequence of steps to break the complex transformation of ‘General scaling directions’ is given below

 

Step-1:Rotate the two scaling directions such that they align with coordinate directions.

 

R (θ)

 

Step-2:Scale with respect to origin

 

S (s1,s2)

 

Step-3:Rotate the two scaling directions back to their original positions.

 

R-1(θ)

 

The above three steps are to be performed in that order. When we convert that into notation form, we have to put the steps in the reverse order (as understood from previous discussion in this module)

 

P’= {R-1(θ).S(s1,s2).R(θ)}.{P}

 

 

We can summarize the above steps in notation form as given below

 

P’= {R(90°).S(2,2)}.{P}

 

Step-1: Scaling w.r.t. fixed point – (2,2).

 

For this you can refer to the composite matrix discussed on ‘general fixed point scaling’ section, and we have

 

 

If you could not remember this, follow the three steps i.e. translate the fixed point, scale with respect to origin and translate back. The composite matrix can be obtained as shown below.

 

Step-2:Rotate by 90° CCW

 

In this step, if the question does not explicitly mention any pivot point for performing transformation, we can safely assume origin as the pivot point.(Otherwise if the question has information on a pivot point about which the transformation is to be performed, then treat this as complex and compute the composite matrix separately as similar to that done in step-1). So we can assume the standard homogeneous matrix representation for rotation as shown below with angle 90°and CCW (counter Clock-Wise)rotations are positive.

 

 

Thus the final composite matrix is obtained by multiplying the two matrices derived, as shown below.

 

 

Now multiply each vertex with the composite matrix and straight away get the new vertex.

 

The new vertices are given below.

 

(2,2) ->   (-2,2)

(2,10) -> (-18,2)

(10,2) ->  (-2,18)

 

End of Solution:

 

Important Note:As every object is made up of a set of vertices, it is enough that we find transformed vertices, and redraw the new object.

 

Steps to solve a problem

  • Form the notation from the given data
  • Convert the notations to equivalent matrix representations
  • Compute the composite transformation matrix
  • Multiply each vertex and get the new vertex.

 

Summary:

  • Learnt about composite 2D transformations and representation in homogeneous coordinates.
  • Also learnt the steps to solve complex transformation problems

 

you can view video on Composite 2D Transformations