0% found this document useful (0 votes)
368 views91 pages

2D Geometric Transformations Guide

The document discusses different types of 2D geometric transformations, including translations, rotations, and scaling. Translations move objects by shifting their position, rotations alter their orientation, and scaling changes their size. These elementary transformations can be combined to produce more complex transformations. The document provides mathematical definitions and examples to illustrate how to apply translations, rotations, and scaling to 2D points and objects.

Uploaded by

vishwajeet patil
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
368 views91 pages

2D Geometric Transformations Guide

The document discusses different types of 2D geometric transformations, including translations, rotations, and scaling. Translations move objects by shifting their position, rotations alter their orientation, and scaling changes their size. These elementary transformations can be combined to produce more complex transformations. The document provides mathematical definitions and examples to illustrate how to apply translations, rotations, and scaling to 2D points and objects.

Uploaded by

vishwajeet patil
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 91

Geometric

Transformations
Dr.Chougule N.K.

1
Geometric transformation

2
Content
 Need of Transformations
 Basic 2D geometric transformations
 2D translation
 2D rotation
 2D scaling
 2D Homogeneous Coordinates
 2D Composite transformations
 Examples on 2D Transformations

3
Types of Transformations
There are two ways of understanding a transformation-
Geometric Transformation and Co-ordinate Transformations
An Object (Geometric) Transformation alters the coordinates
of each point according to some rule, leaving the underlying
coordinate system unchanged
i.e.Moving object relative to a stationary co-ordinate system

{.4, 2}

{1,1}

Another example to animate flying of aeroplane, we require aeroplane as object and sky
as background. In geometric transformation, we can simulate this by moving aeroplane
while keeping the sky background fixed.
Types of Transformations continued….

A Coordinate Transformation co-ordinate system is moved relative


to the object.

{1,1}

{1,1}

We can simulate aeroplane by keeping aeroplane fixed while moving background i.e.
sky.

Now we will be studying geometric transformations in the


last part of this UNIT
Need of Transformations
1. Sometimes objects exhibit certain symmetries, so only a part of it
needs to be described, and the rest constructed by reflecting,
rotating and translating the original part
 Object parts defined in a local
co-ordinate system:

etc...

 Larger objects are then


“assembled” by duplicating
and transforming each of the
constituent parts:
Need of Transformations
 The arch is designed in its own coordinate system.
 The scene is drawn by placing a number of instances of the arch at
different places and with different sizes.
Need of Transformations
 The snowflake exhibits symmetries.
 We design a single motif and draw the whole shape using
appropriate reflections, rotations, and translations of the motif.

use it 12 times
Need of Transformations continued…..
2. A designer may want to observe object from different view points, by
rotating /moving the object

XYZ- world coordinate system,


Xv, Yv, Zv view coordinate system
Need of Transformations continued…..
3. In animation, one or more objects must move relative to one another, so
that their local co-ordinate systems must be shifted and rotated as the
animation proceeds.

5 steps of a “rotating cube” animation

 At each frame of the animation, the object is transformed, in this case


by a rotation.
 It could also be transformed by changing its size (scaling), or its shape
(deformation), or its location (translation).
10
11
Types of Transformations
There are two ways of understanding a transformation-
Geometric Transformation and Co-ordinate Transformations
An Object (Geometric) Transformation alters the coordinates
of each point according to some rule, leaving the underlying
coordinate system unchanged
i.e.Moving object relative to a stationary co-ordinate system

{.4, 2}

{1,1}

Another example to animate flying of aeroplane, we require aeroplane as object and sky
as background. In geometric transformation, we can simulate this by moving aeroplane
while keeping the sky background fixed.
Types of Transformations continued….

A Coordinate Transformation co-ordinate system is moved relative


to the object.

{1,1}

{1,1}

We can simulate aeroplane by keeping aeroplane fixed while moving background i.e.
sky.

Now we will be studying geometric transformations


2D Object Geometric Transformations
 A 2D object transformation alters each point P into
P = {Px, Py}
a new point P’ using certain rules

 It therefore alters the co-ordinates of P {Px, Py} ???


DO SOMETHING
into new values which specify point P’ {P’x,P’y} ???
 This can be expressed using some function Tr, that
maps co-ordinate pairs into new co-ordinate pairs: P’ = {P’x, P’y}
 {P’x,P’y} = {Px,Py} . Tr
 May simply be denoted as P’ = P. Tr

P = {2, 2}
 e.g: P is the point {2, 2}, Tr is a transform that
scales by a factor of 2. Then T(P) = 2({2, 2}) = {4,4}

Scale by 2

P’ = {4, 4}
Elementary Geometric Transformations
 Transformations are usually combinations of Three elementary
transformations:

 1: Translation

 2: Scaling

 3: Rotation
1.Translation Transformation ( T )
 A translation moves an object into a different position in a scene
If P’- New position of point P, P-Original position and
T- Translation matrix then, Mathematically P’ =P+T
x’ = x + tx and y’ = y + ty ,
tx & ty are translation factors along X and Y direction

In Matrix form x' y '  x y   tx ty 


This is normally the operation used in CAD T
system as move command.

Translate by T

Original points Transformed points


1.Translation (Move) Transformation ( T )
Ex1-Translate a triangle with coordinates A (2,5), B (2,9) and C (8,5) by 8 units in x
direction and 2 units in y direction.
x' y '  x y   tx ty 

Thus new coordinates of


translated triangle are
A’(10,7), B’(10,11) and C’(16,7).
2.Rotation (Spin) Transformations ( R )
Rotating an object changes its position and orientation.
 Consider a point P(x,y) is to be rotated about origin by angle q in counter
clockwise direction to a new position P’(x’,y’).
 Here r is the distance of point from origin and  is initial angular position of
the point from horizontal.
P’

q P

Rotate by q

Original points
Transformed points
18
Rotation - derivation
PX  R cos ( ) [1]
Py  R sin ( ) [2]

P' X  Rcos( q   ) [3]


P' y  Rsin( q   ) [4]
P’
P'x  Rcos (q ) cos ( )  Rsin (q ) sin ( )

q P'x  Pxcos (q )  Py sin (q )


PY P
 Similarly P' y  Pycos (q )  Px sin (q )
R PX
In Matrix form
 cos q sin q 
P' x P' y   Px Py   
 sin q cos q 
cos (q  )  cos (q) cos ()  sin (q) sin ()
sin (q  )  sin (q) cos ()  cos (q) sin ()
Rotation – Example2
 Rotate a point P(10,5) counter clockwise by 300 and find rotation matrix and
resultant point.

20
3. Scaling Transformation ( S )
 A scaling changes the size of an object with two scale factors, Sx and Sy (if
Sx = Sy, then we have a uniform scale)
 If a scaling factor greater than one indicates an expansion of
length and less than one indicates a compression of length
 If Sx or Sy < 0, the image is reflected across the x or y axis.
Sx, Sy

Scale by
Sx, Sy
Original points Transformed points

Mathematically Px’ = Px. Sx and Py’ = Py. Sy

In Matrix Form P' x p' y   Px Py   


Sx 0
0 Sy 
Types of Scaling
 Pure reflections, for which each of the scale factors is +1 or -1.
 A uniform scaling, or a magnification about the origin: Sx = Sy,
magnification |S|.
 Reflection also occurs if Sx or Sy is negative.
 If |S| < 1, the points will be moved closer to the origin, producing
a reduced image.
 If the scale factors are not the same, the scaling is called a
differential scaling.

If Sx or Sy < 0, the image is reflected


across the x or y axis
Uniform Scaling

X' Y'
4 2
(2,1) 2

P' x p' y   Px Py   Sx 0 


 
 0 Sy 

P' x p' y   2 1  
2 0
 = [4 2 ]
 0 2 

Ch 5 - 23 CS 380
Differential Scaling -Distortion

X  2,
Y  0.5

P' x p' y   Px Py   Sx 0 


 
 0 Sy 

P' x p' y   2 1  
2 0 
 = [4 0.5 ]
 0 0 .5 
3. Scaling Transformation ( S )
Example 3-Scale the rectangle A(-1,-1), B(1,-1), C(1,1) and D(-1,1) by
2 units in x and y direction about origin
3. Scaling Transformation ( S )
If Sx < 0, the image is reflected across the Y axis

Example 3-Scale the rectangle A(-1,-1), B(1,-1), C(1,1) and D(-1,1) by


-1 units in x direction about origin

C’ D’

B’ A’

1 -1
-1 0 -1 -1
0 1 -1 1
1 1
3. Scaling Transformation ( S )
If SY < 0, the image is reflected across the X axis

Example 3-Scale the rectangle A(-1,-1), B(1,-1), C(1,1) and D(-1,1) by


-1 units in y direction about origin

A’ B’

D’ C’

-1 1
1 0 1 1
0 -1 1 -1
-1 -1
3. Scaling Transformation ( S )
If Sx or Sy < 0, the image is reflected across the x or y axis

Example 3-Scale the rectangle A(-1,-1), B(1,-1), C(1,1) and D(-1,1) by


-1 units in x and y direction about origin

B’ A’

C’ D’

1 1
-1 0 -1 1
0 -1 -1 -1
1 -1
Differential Scaling
• If the scale factors are the same, Sx = Sy 
uniform scaling P’
• Only change in size (as previous example)

•If Sx  Sy  differential scaling.


•Change in size and shape
•Example : square  rectangle
•P(1, 3), Sx = 2, Sy = 5 , P’ ?
P(1, 2)
Homogeneous Coordinates
The basic transformations are translation, rotation and scaling and they can be expressed in
the general matrix form as given by-
P’ = P. M1 + M2
For Translation- 1 0 tx 
P’=P. 0 1  ty  Where M1 is Identity matrix and M2 is Translation vector
   

For Rotation –  cosq sin q  0


P’=P.  sin q 
 cos q  0 Where M1 is rotational matrix and M2 = 0

For Scaling-
 Sx 0  0
P’=P.     Where M1 is Scaling matrix and M2 =0.
 0 Sy  0

For composite transformations-eliminate the matrix addition associated with the


translation matrix M2. To achieve this for 2D transformation, represent the matrix M1
as 3 x 3 matrix instead of 2 x 2 by introducing an additional dummy co-ordinate .

Thus all 2D points are represented by three numbers (x,y,1) instead of two. This co-
ordinate system is called homogeneous co-ordinate system. 30
Homogeneous Representation
Translation
1 0 0
0 1 0
x' y' 1 x y 1 
P'  P  T tx ty 1
Rotation  cosq sinq 0

P'  P  R    

x' y' 1  x y 1  sinq cosq 0
 0 0 1
Scaling  Sx 0 0
x' y' 1 x y 1  0 Sy 0 
P'  P  S 
 0 0 1 
Example 4 -A triangle ABC with vertices A(30,20) B ( 90,20) C ( 30,80) is to be rotated
anticlockwise direction by 30º angle. Give 3 x 3 homogeneous coordinate matrix and
find the new position of the vertices.
C The equation for the transformation is as follows P’ = P x R.
y
The 3 x 3 homogeneous coordinate matrix R is given by-

 Cos q Sin q 0   Cos 30 Sin 30 0 0.866 0.5 0


A B

R =   Sin q Cos q 0     Sin 30 Cos 30 0  = 0.5 0.866 0
 0
 
0 1   0 0 1 
x  0 0 1
For triangle ABC

 Ax' Ay ' 1  Ax Ay 1  Cos q Sin q 0 30 20 1  0 . 866 0 .5 0


 Bx' By ' 1   
   Bx By 1   Sin q Cos q 0 
90 20 1 x   0 .5 0 . 866 0 
Cx ' Cy ' 1    
Cx Cy 1  0 1  30 80 1
0  0 0 1 
 15 . 98 32 . 32 1
  67 . 94 62 . 32 1 

  14 . 02 84 . 28 1 

Hence the new co-ordinates are A’ [15.98 , 32.32 ] B’ [67.94 , 62.32 ] & [ -14.02 , 84.28 ]
32
INVERSE TRANSFORMATIONS
When we apply any transformation to point P(x,y) we get new point P’(x’y’).
Sometimes it is required to undo the applied transformation and thus we
get again original point P(x,y). This can be achieved by inverse
transformation.
P(x,y) P’(x’y’) Forward Transformation ( T )

P(x,y) P’(x’y’) Backward (Inverse) Transformation ( T-1)

.
The elements for the inverse matrix T-1 can be calculated from the elements of T as
below.
ei j
-1 = [ (-1)i+j . det Mji ] / det T
Where
ei j-1 is the element in the ith row and jth column of T-1.
Mji is the (n-1) by (n-1) sub matrix obtained by deleting jth row and ith column
of matrix T.

33
INVERSE TRANSFORMATIONS for Translation
The translation matrix is given by –
 1 0 0 Elements of T-1 is
  0 1 0
T
given by –
tx ty 1

ei -1 = [ (-1)i+j . det Mji ] / det T det T = 1(1-0) – 0 (0 – 0) + 0 (0-tx) = 1


j

e11-1 = [ (-1)2 . det M11 ] / 1 = 1.(1 x 1- ty x 0) = 1


e12-1 = (-1)3 . (0 x 1 – tx x 0) = 0
e13-1 = (-1)4 . (0 x 0 – 1 x 0) = 0  1 0 0
e21-1 = [ (-1)3 . (0 x 1- tx x 0) = 0 T-1 
 0 1 0 
 
e22-1 = (-1)4 . (1 x 1 – tx x 0) = 1  tx  ty 1
e23-1 = (-1)5 . (1 x 0 – 0 x 0) = 0

e31-1 = [ (-1)4 . (ty x 0- tx x 1) = -tx


e32-1 = (-1)5 . (ty x 1 – tx x 0) = -ty
e33-1 = (-1)6 . (1 x 1 – 0 x 0) = 1
34
INVERSE TRANSFORMATIONS

35
Multiple (Composite) Transformations
 It is rare that we want to perform just one elementary transformation.
 Usually an application requires that we build a complex transformation
out of several elementary ones
 e.g. translate an object, rotate it, and scale it, all in one move

 These individual transformations combine into one overall


transformation

 This is called the composition of transformations.

Matrix Concatenation Properties


M3· M2· M1= (M3· M2 ) · M1 = M3· ( M2 · M1 )
M2 · M1 ≠ M1 · M2
Order of operations is Important
So, it does matter. Let’s look at an example:
1. Translate 1. Rotate
2. Rotate 2. Translate

?
T.R = R.T
Compositing Transformations
 Does order matter? 1 0  2 
T  0 1 0 
 Case 1: translate by (–2, 0), scale by (2, 2)
 Case 2: scale by (2, 2), translate by (-2, 0)
 Begin: red, 1st transform: blue, 2nd: green
0 0 1 
 2 0 0
S  0 2 0
y y
(0,6) (2,6)
(4,6)
0 0 1

(0,3) (2,3) (2,3)

(-2,2) (2,2) (4,2)


(2,2) (0,2) (6,2)

(-1,1) (1,1) (1,1) (3,1) (1,1) (3,1)


x x
Case 1 (translate then scale) Case 2 (scale then translate)

38
Commutative Combinations of transformations
1. Translate, Translate
2. Scale, Scale
3. Rotate, Rotate
4. Scale Uniform, Rotate (Su .R = R .Su)

Non-Commutative Combinations of
transformations

1. Rotate , Translate
2. Scale, Translate
3. Differential Scale (Sx=/ Sy), Rotate

39
Reversing Order in which a sequence of transformations is
performed may affect the transformation position of an object.

a. T.R. b. R.T

40
Multiple (Composite) Transformations
Combined transformation can be achieved by two ways –
•Step by Step Method
•Matrix Concatenation Method

Step by Step or Direct Method:


Each transformation is applied at a time in sequence and resulting
transformed values are taken as the new values of x,y for next transformation.

Firstly co-ordinates are translated then these translated co-ordinates are


rotated and finally the rotated co-ordinates are scaled which gives cumulative
effect of above all transformations. This sequential transformation is not efficient
as it takes a lot of time for the calculation of intermediate co-ordinate values.
•Matrix Concatenation Method
The various relevant transformation matrices are multiplied in a sequence to
obtain final cumulative composite transformation. Here all the
transformations are combined into one transformation so that the final co-
ordinate positions are obtained directly from initial co-ordinates, which
reduce a lot of time and complications.
Multiple (Composite) Transformations
Rotation about an arbitrary point A
Y Y
Y
Y

T T-1
R
10 10
10
B 10

C* B*
5
5 5
5
C” B”
A B C’
A*
X
30o
0 5 10
A’0 5 10
X 0 5 10
X 0 5 10
X

B’ A”

Step by Step Method Matrix Concatenation Method

P’ = P. T Tresult = T. R . T-1
P’’ = P’. R P’’’ = P. Tresult

P’’’ = P’’. T-1


Rotation about Pivotal point
 Often we wish to rotate or scale with respect to some pivotal point, not the origin
B. We then rotate or about the
origin

B
 cosq sinq 0
R   sinq cosq 0
Torotate about the pivotal point V-  0 0 1
A. We first translate all points so that V
coincides with the origin
 1 0 0
T1  0 1 0 C. then all points are translated back, so
 Xr Yr 1 that V is restored to its original location
A

 1 0 0
T 2   0 1 0
Tresult = T1. R . T2 C  Xr Yr 1

P’ = P. Tresult
Example-Rotation about Pivotal point
Perform a counter clockwise 300 rotation of triangle ABC with A(4,3), B(10,3)
and C(4,7) about vertex point A.
Y Y
Y
Y

T1 T2
R
10 10
10
B 10

C* B*
5
5 5
5
C” B”
A B C’
A*
X
30o
0 5 10
A’0 5 10
X 0 5 10
X 0 5 10
X

B’ A”

Tresult = T1. R . T2
 1 0 0 Cos30 Sin30 01 0 0  0 . 87 0 .5 0
 0 
Tresult  0 1 0 Sin30 cos30 00 1 0 =   0 .5 0 . 87
 4  3 1 0 0 14 3 1  2 . 03  1 .6 1 

 Ax * Ay * 1  4 3 1
 Bx * By * 1  10 Ax* Ay* 1 4 3 1
   3 1.Tresult Bx* By* 1  9.2 
Cx * Cy * 1  4 7 1    6 1 
Cx* Cy* 1  2 6.46 1
Scaling about Arbitrary Point ,P

T
P
P

Fig. A Fig. B

TST-1 T-1
S

Fig. C Fig. D

To scale an object about point P(fig A), we have to carry out following steps-
•Translate the point P to the origin is at (x0,y0). Figure(B)
•Scale it about origin by scaling factors Sx and Sy. Figure(C)
•Finally translate back to point P (Inverse translation) Figure(D)
45
Flip (Mirror/Reflection ) Transformation
1. About X axis
2. About Y axis
3. About Origin
4. About y=x
5. About y = m X +c
Flip (Mirror/Reflection ) Transformation

x-axis y-axis
1 0 0
0  1 0
 
0 0 1

 1 0 0
 0 1 0
 
 0 0 1
Flip (Mirror/Reflection ) Transformation

About X axis

48
Other transformations
Reflection:
origin 0 1 0
line x=y
 1 0 0 1 0 0
 0  1 0  
 
 0 0 1 0 0 1
Flip (Mirror) Transformation
About Y axis About Origin

50
Flip about Arbitrary Axis

51
Reflection about any arbitrary axis
Tr = T.R.Fx.R-1 T-1
Reflection about an arbitrary axis

(0,0) X
(0,0) X

y=
mx
y=

+c
mx
+c

Reflection about an arbitrary axis y=mx+c Reflection of the object

55
Shear transformations
x-direction y-direction
1 shx 0 1 0 0
0 1 0 sh 1 0
   y
0 0 1  0 0 1
Shear Transformation
X Shear

57
Shear Transformation
Y Shear

58
Shear (cont.)
Example: x-direction shear
Given shx =2, relative to the x-axis ( y = 0), and a
square with coordinates (0,0), (0,1), (1,1), (1,0).

59 CS 380
Shear (cont.)
Example: y-direction shear
Given shy =2, relative to the y-axis ( x = 0), and a
square with coordinates (0,0), (0,1), (1,1), (1,0).

60 CS 380
Inverse Flip

61
Shear trans. example

62
Shear trans. example

63
Shear trans. example

64
2D Transformations

a b 0

Tr   c d 0
 e f 1
Non zero e, f - Translation
Non zero a,b,c,d- Rotation, Scaling, Shear

Negative a,b,c,d- Reflection

65
Coordinate Transformations
Transformation of an Object Description from
One Coordinate System to Another
 Multiple Coordinate System
 Local (modeling) coordinate system- (UCS)
 World coordinate scene (WCS)

Local Coordinates

World Coordinate System


66
Coordinate System Transformations
• We often need to transform points from one coordinate system
to another:
1. We might model an object in non-Cartesian space (polar)
2. Objects may be described in their own local system
3. Other reasons: textures, display, etc
4. Assembly
Coordinate Transformations
 Example – Simulation of Tractor movement
 As tractor moves, tractor coordinate system and front-
wheel coordinate system move in world coordinate system
 Front wheels rotate in wheel coordinate system

68
Geometric Mapping Applications
 Building a 3D model
 Representing actual physical object on a Display
screen
 Plotting an object on O/P device
 Used in assembly modeling where many parts
created in their own co-ordinate sys. Are mapped
to Assembly co-ordi. System.
 To merge One part into another
 Animation

69
Local (UCS) vs. Global Co-ordinates (WCS)
 In practice we find that it is cumbersome in most applications to have
to recalculate the individual points that make up an object
 It is more common to define the object with reference to some local co-
ordinate origin (or reference point) and axis.
 We then specify through a transformation matrix how this reference
frame relates to the Global reference frame.

70
Geometric Mapping
Representing an Object from one co-ordinate system
to another. WCS, UCS,SCS etc.
Types- 1.Translation 2. Rotational and 3.General
1.Translation 2. Rotational

 1 0 0  cosq sinq 0
 0 1 0  sinq cosq 0
   
tx ty 1  0 0 1 71
Geometric Mapping
3.General Mapping – Both Translation and Rotational Mapping

 cosq sinq 0
T .R   sinq cosq 0
 tx ty 1

72
1a. Translation Mapping- Coordinates in WCS
If Co-Object ordinates are given in WCS (i.e. Map fromWCS to
UCS ) –Transform UCS

tx= -3, ty=-2

A(4,3) B(4,5) C(7,5) D(7,3)

 Ax' Ax' 1  Ax Ay 1  1 0 0  Ax' Ay ' 1 4 3 1  1 0 0


 Bx' Bx' 1  Bx By 1 0 1 0  Bx' By ' 1 4 5 1 0 1 0
  .    . 
 Cx ' Cx ' 1  Cx Cy 1  tx ty 1   Cx ' Cy ' 1 7 5 1  3  2 1 
 Dx' Dx' 1  Dx Dy 1    Dx' Dy ' 1 7 3 1  
 Ax' Ay ' 1 1 1 1
 Bx' By ' 1 1 3 1
  
 Cx ' Cy ' 1 4 3 1
 Dx' Dy' 1 4 1 1 73
1b. Translation Mapping- Coordinates in UCS
If Co-Object ordinates are given in UCS (i.e. Map from UCS to
WCS ) –Transform WCS

tx= 3, ty=2
Coordinates in UCS
A(1,1) B(1,3) C(4,3) D(4,1) Coordinates in WCS
A(4,3) B(4,5) C(7,5) D(7,3)

 Ax' Ax' 1  Ax Ay 1  1 0 0  Ax' Ay ' 1 1 1 1 1 0 0


 Bx' Bx' 1  Bx By 1 0 1 0  Bx' By ' 1 1 3 1 0 1 0
  .    . 
 Cx ' Cx ' 1  Cx Cy 1  tx ty 1   Cx ' Cy ' 1 4 3 1 3 2 1 
 Dx' Dx' 1  Dx Dy 1    Dx' Dy' 1 4 1 1  
 Ax' Ay ' 1 4 3 1
 Bx' By ' 1 4 5 1
  
 Cx ' Cy ' 1 7 5 1
 Dx' Dy' 1 7 3 1 74
1. Translation Mapping …… contt
If Co-Object ordinates are given in UCS (i.e. Mapping from
UCS to WCS ) –Transform WCS

tx= 3, ty=2

A(4,3) B(4,5) C(7,5) D(7,3)

 Ax' Ax' 1  Ax Ay 1  1 0 0  Ax' Ay ' 1 1 1 1 1 0 0


 Bx' Bx' 1  Bx By 1 0 1 0  Bx' By ' 1 1 3 1 0 1 0
  .    . 
Cx ' Cx ' 1 Cx Cy 1 tx ty 1  Cx ' Cy ' 1 4 3 1 3 2 1 
    
 Dx' Dx' 1  Dx Dy 1    Dx' Dy' 1 4 1 1  
 Ax' Ay ' 1 4 3 1
 Bx' By ' 1 4 5 1
  
 Cx ' Cy ' 1 7 5 1
 Dx' Dy' 1 7 3 1 75
2. Rotational Mapping
If Co-Object ordinates are given in UCS (i.e. Mapping from
UCS to WCS ) –Transform WCS
A -0.366 1.366
B--0.634 3.098
C-1.964 4.598
D-2.964 2.866

Rotate WCS in
Anti-Clockwise

 Ax' Ax' 1  Ax Ay 1  Cos30 Sin30 0  Ax' Ax' 1 1 1 1  0.86 0.5 0


 Bx' Bx' 1  Bx By 1  Sin30 Cos30 0  Bx' Bx' 1 1 3 1  0.5 0.86 0
  .    . 
Cx ' Cx ' 1 Cx Cy 1 0 0 1  Cx ' Cx ' 1 4 3 1 0 0 1
    
 Dx' Dx' 1  Dx Dy 1    Dx' Dx' 1 4 1 1  
 Ax' Ax' 1  0.40 1.4 1
 Bx' Bx' 1  0.6 3.1 1
  
 Cx ' Cx ' 1 1.96 4.6 1
 Dx' Dx' 1  2.96 2.8 1 76
2. Rotational Mapping …… contt
If Co-Object ordinates are given in WCS (i.e. Map fromWCS to
UCS ) –Transform UCS

A -0.366 1.366
B--0.634 3.098
C-1.964 4.598
D-2.964 2.866

Rotate UCS in
Clockwise

 Ax' Ax' 1  Ax Ay 1  Cos  30 Sin  30 0  Ax' Ax' 1  0.40 1.4 1 0.86  0.5 0
 Bx' Bx' 1  Bx By 1  Sin  30 Cos  30 0  Bx' Bx' 1  0.6 3.1 1  0.5 0.86 0
  .      
 Cx ' Cx ' 1  Cx Cy 1  0 0 1   Cx ' Cx ' 1 1.96 4.6 1 0 0 1
 Dx' Dx' 1  Dx Dy 1    Dx' Dx' 1  2.96 2.8 1  

 Ax' Ax' 1 1 1 1
 Bx' Bx' 1 1 3 1
  
 Cx' Cx' 1 4 3 1
77
 Dx' Dx' 1 4 1 1
3. General Mapping
If Co-Object ordinates are given in UCS (i.e. Mapping from
UCS to WCS ) –Transform WCS
Co-ordinates in WCS
A( 1.9,4.5 ) b( 0.96,6.3)
C(3.5,7.8 ) D( 4.5,6.1)

Translate Rotate WCS in


WCS Anti-Clockwise
30 degree
 Ax' Ax' 1 1 1 1  0.86 0.5 0  Ax' Ax' 1 1.96
 Bx' Bx' 1 1 4.5 1
3 1  0.5 0.86 0  Bx' Bx' 1  .96 6.3 1
  . 
 Cx' Cx' 1 4 3 1 3 2 1   
 Cx ' Cx ' 1  3.5 7.8 1
 Dx' Dx' 1 4 1 1  
 Dx' Dx' 1  4.5 6.1 1

78
3. Generall Mapping …… contt
If Co-Object ordinates are given in WCS (i.e. Map fromWCS to
UCS ) –Transform UCS
Co-ordinates in WCS
A( 1.9,4.5 ) b( 0.96,6.3)
C(3.5,7.8 ) D( 4.5,6.1)
Translate UCS

Rotate UCS
in Clockwise

 Ax' Ax' 1  1.9 4.5 1 0.86  0.5 0  Ax' Ax' 1 1 1 1


 Bx' Bx' 1 0.96 6.3 1  0.5 0.86 0  Bx' Bx' 1 1 3 1
  .    
1   3  2 1   Cx ' Cx ' 1 4 3 1
 Cx' Cx' 1 3.5 7.8
 Dx' Dx' 1 4 1 1
 Dx' Dx' 1  4.5 6.1 1  

79
Geometric Mapping

To Map fromWCS to UCS


(Co-Object ordinates are given in WCS) –Transform UCS

To Map from UCS to WCS –


Transform WCS

80
Geometric Mapping
1. The co-ordinates of triangle ABC in UCS are A(2,2) B(4,4) & C( 3,5).
The coordinate of origin of UCS in WCS are (2,2). If the X axis of UCS
makes an angle 30 with X axis of WCS. Determine the coordinates of
vertices of triangle ABC in WCS.
 Ax' Ax' 1 2 2 1  0.86 0.5 0
 Bx' Bx' 1 4 4 1  0.5 0.86 0
Transform WCS   . 
 Cx ' Cx ' 1   3 5 1  2 2 1 
     

2. The co-ordinates of lowermost corner of rectangle in WCS are A(4.268,


6.732) & diagonal corner are (3.804, 13.928). With ref. to WCS, the
origin of UCS are (5,4). If axes of UCS is at 60 deg, in CCW w.r.t. axes of
WCS. Determine the coordinates of rectangle in UCS.
 Ax' Ax' 1 4.268 6.732 1 0.86  0.5 0
 Bx' Bx' 1 0.804 8.732 1  0.5 0.86 0
Transform UCS   . 
 Cx ' Cx ' 1 3.804 13.928 1   2  2 1 
 Dx' Dx' 1 7.268 11.928 1  
Geometric Mapping
1. The co-ordinates of triangle ABC in UCS are A(2,2) B(4,4) & C( 3,5).
The coordinate of origin of UCS in WCS are (2,2). If the X axis of UCS
makes an angle 30 with X axis of WCS. Determine the coordinates of
vertices of triangle ABC in WCS.

Transform WCS: A’(2.73, 4.732) B’(3.464, 7.464) C’(2.098, 7.83)

2. The co-ordinates of lowermost corner of rectangle in WCS are A(4.268,


6.732) & diagonal corner are (3.804, 13.928). With ref. to WCS, the
origin of UCS are (5,4). If axes of UCS is at 60 deg, in CCW w.r.t. axes of
WCS. Determine the coordinates of rectangle in UCS.
Transform UCS: A’(2, 2) B’(2,6) C’(8,6) D’(8,2)
Geometric Mapping
To transfer from WCS Data to VCS following Eqns. Are used

(Xv2-Xv1) (Xw-Xw1)
Xv = ----------------------------- + Xv1
(Xw2-Xw1)

(Yv2-Yv1) (Yw-Yw1)
Yv = ----------------------------- + Yv1
(Yw2-Yw1)

83
84
85
Next Lecture …….
3D Object Transformations
scaling

translation

rotation

90
Why composition?
 One of the main reasons for composing transformations is
computational efficiency

 Suppose you want to apply two affine transformations


to the N vertices of a polygonal object a b t x  a1 b1 t x1  a2 b2 tx2 
c d t   c d t  c d2 t y 2 
 It requires 18 multiplications* to compose the  y  1 1 y1   2

transformations, and 6 multiplications to apply a 0 0 1   0 0 1   0 0 1 


transformation to a point Qx   a b t x   Px 
 So, “compose-then-apply” requires 6N+18 and Q y    c d t y   Py 
multiplications  1  0 0 1   1 

 12N multiplications are required if each  P' x  a1 b1 t x1   Px 


transformation is applied separately (and possibly  P'    c d1 t y1   Py 
 y  1
 1   0 0 1   1 
 For models with any significant number of vertices Q x   a 2 b2 t x 2   P'x 
Q    c t y 2   P ' y 
{which will be most}, 6N+18 is much less than 12N  y  2 d2

 e.g. if N=10000, 6N+18 = 60018, 12N = 12000  1   0 0 1   1 

 i.e. about half the effort

* : clever graphics systems will take into account that the bottom row doesn’t need to be
multiplied out. But even in this case Compositions takes about half the time (9N+27 vs. 18N)

You might also like