OVERVIEW(Transformation)
• Representation of points
• Two dimensional transformations
• Matrix representations
• Inverse transformations
• Three-dimensional transformations
• Multiple transformations
Geometric transformation functions
• Translation
• Rotation
• Reflection
• Scaling
• Shearing
• 2D transformations are discussed first, then 3D
transformation will be discussed.
2D Translations
Point P defined as P( x, y),
translate to Point P( x, y) a distance d x parallel to x axis, d y parallel to y axis.
x x d x y y d y
Define the column vectors
x x d x
P , P , T
y y dy
Now
P P T P’
P
2D Transformation.
Point P defined as P( x, y ),
Perform a 2d tranformation to a Point P( x, y) by a Matrix S
Define the matrix
a c
S
b d
Now
x a c x
P S P or y b d . y
2D Scaling from the origin.
if b c 0
if a 1 and d 1 it is called identity tranformation
if a -1 and d 1 it is called reflection y - axix
if a 1 and d -1 it is called reflection about x - axis
if a d 0 it is called reflection about origin
if a d 1
c 0 then it is called shearing transformation
proprtional to x - coordinate.
b 0 then it is called shearing transformation
proprtional to y - coordinate
x a c x
P S P or y b d . y
2D Scaling from the origin. Px Py Pz 1
if b and c is zero than the transformation is called scaling
Sx and Sy is same then the scaling is called uniform and non - uniform
x a.x, y d . y
Define the matrix
P’
a 0
S
P
0 d
Now
x a 0 x
P S P or y 0 d . y
2D Scaling and reflection Transformations
Scaling in x-direction Scaling in x-axis and y-axis
Reflection about y-axis Reflection about origin
2D Shearing Transformation
Shearing proportional to x-axis Shearing proportional to y-axis
2D Transformation of square.
2D Transformation of square.
2D Transformation of square(Reflection)
2D Transformation of square(Scaling)
2D translation(Shearing)
Mid point transformation
Mid point of transform line
Mid point of original line
Same transformation for the mid point of the original line gives the
Mid point of transformed point is calculated above
Mid point transformation
2D Rotation about the origin.
P’(x’,y’)
P(x,y)
r
r
x
2D Rotation about the origin.
y
P’(x’,y’)
r
P(x,y) x r. cos
y r. sin
y
r
x
x
2D Rotation about the origin.
x r. cos( ) r. cos . cos r. sin . sin
y y r. sin( ) r. cos . sin r. sin . cos
P’(x’,y’)
P(x,y)
r x r. cos
y r. sin
y
r
x
x
2D Rotation about the origin.
x r. cos( ) r. cos . cos r. sin . sin
y r. sin( ) r. cos . sin r. sin . cos
Substituting for r :
x r. cos
y r. sin
Gives us :
x x. cos y. sin
y x. sin y. cos
2D Rotation about the origin.
x x. cos y. sin
y x. sin y. cos
Rewriting in matrix form gives us :
x cos sin x
y sin .
cos y
cos sin
Define the matrix R , P R P
sin cos
Similar transformation using row vector
a b
x y x y .
c d
cos( ) sin( )
x y x y .
sin( ) cos( )
Properties of 2D Rotation Matrix
If geometry is column matrix
T(R(theta())-1 = T(R(-theta))
Properties of 2D Rotation Matrix
2D Rotation Matrix
Rotation by 90°
Reflection
Reflection of Triangle DEFabout y=x
Reflection about x-axis
Combined reflections result rotation
Reflection about x-axis
Reflection about y=-x
Above combined reflections can
Be obtained by 270° rotation
Scaling
Scaling
1 -1
2 2
-2 -1
Transformations.
• Translation.
– P = T + P
• Scale
– P = S P
• Rotation
– P = R P
• We would like all transformations to be multiplications so we can
concatenate them express points in homogenous
coordinates.
Combined transformations
Rotation about origin by 90 degree
Reflection about y = -x
Graphical Representation of previous problem
Trianle ABC for roated by 90° then
reflected along y =-x
Triangle ABC reflected fist along y =-x than rotated by
90°. The final triangle in D*E*F*.
Fig. 2-10
Transformation of parallel lines
Transformation of intersecting lines
Putting value of and in above equation
Assuming first line
bx1+dy1 - (b+dm1)/(a+cm1) ((ax1+cY1)= b1*
((bx1+dy1 )( a+cm1) - (b+dm1)( ((ax1+cY1))/(a+c m1 )
(ab x1 + ady1 +cm1 bx1 + cd y1m1 )-( ab x1
+adx1m1+cby1-dcm1y1 ))/( a+cm1)
( ady1 +cm1 bx1 + -adx1m1-cby1)/(a+cm1)
(y1 -m1 x1 )(ad-bc)/ (a+cm1) = b1(ad-bc)/ (a+cm1)
x-coordinate for intersection of
transformed line
B1*- B2* = (ad-bc)(( b1/(a+cm1) – b2/*a+cm2)) = (ad-
bc)(b1x(a+cm2) – b2(a+cm1)) /(a+bm2)( a+bm1)
(ad-bc)(a(b1-b2)+c(b1m2-b2m1))
M2* -M1* = (b+dm2)/(a+cm2) - (b+dm1)/(a+cm1) =
(b+dm2)(a+cm1)-(b+dm1)(a+cm2))/((a+cm1)( b+cm2) = (m2-
m1)(ad-bc)
X= (B1*-B2*)/(M2*-M1*) = (ad-bc)((ab1+cB2m1-ab1-b1cm2) =(ad-
bc)(a(b1-b2)+c(b1m2-b2m1)/ (( m2-m1)(ad-bc))
= (a(b1-b2)+c(b1m2-b2m1))/ (( m2-m1))
Calculation for y-coordinate for intersection
of transformed line
Y* = (m2*B1* -B2*m1)/ (m2*-m1* )= (b+dm2)/(a+cm2)
(ad-bc) b1/(a+cm1)) - (b+dm1)/(a+cm1 (ad-
bc)b2/(a+cm2)) /((ac-bd) (m2-m1)/ ((a+cm1)( b+cm2) )
=((b+dm2) (ad-bc) b1 - (b+dm1) (ad-bc)b2)/((a+cm1)(
b+cm2) )/((ad-bc)(m2-m1)/((a+cm1)( b+cm2) )
= (ad-bc)( bb1+dm2b1 – bb2-b2dm1)/((m2-m1)(ad-bc)
= ( b(b1-b2) + d(m2b1-m1b2)/((m2-m1)
Example for intersection of two line before
and after transformation
Two line AB and BC and following end points
a b
Slop and intercept of transformed lines c d
Equation of initial lines
X* =(a(b1-b2)+c(b1m2-b2m1))/ (( m2-m1))
1(-1/3-1) +1(-1/3x-1 -1x2/3)/(-1-2/3)
-4/3 +(1/3-2/3)/ (-5/3) = -5/3/-5/3 =1 m1 =2/3, m2 =-1
b1= -1/3, b2 = 1
Y*=(b(b1-b2) + d(m2b1-m1b2)/((m2-m1)
2(-1/3-1) + -3(-1x-1/3 -(2/3x1) -8/3+ -3(1/3-2/3) /(-1-2/3)
=(-8/3+1)/ (-5/3)=1
Combined transformations