Upload
japan-vasani
View
182
Download
3
Embed Size (px)
Citation preview
Computer Aided Design (2161903)
Active Learning Assignment
Topic: Two Dimensional Geometric Transformation
Division:-Mechanical 6th D (D3)
Guided by: Prof. Dhaval P. Patel
Student name: Enrollment no.
Vasani Japan R. 150123119056CAD 1
Contents Two Dimensional Geometric Transformation
• Translation
• Rotation
• Scaling
• Reflection
• Shear
Homogeneous Coordinates
Composite Transformation
Example
CAD 2
Two
Dimensional
Geometric
Transformati
on
ShearReflect
ion
Transla
-tion
Rotatio
nScaling
CAD 3
Translation
xtxx '
ytyy '
x
y
p
P’
T
x
y
T
Translation transformation
• Translation vector or shift vector T = (tx, ty)
• Rigid-body transformation
• Moves objects without deformation
CAD 4
Rotation
x
y
P(x,y)
P’ (x’,y’)
r𝜽
Consider rotation of a point about origin
Let point P(x y) be rotated by an angle𝜽 about
origin O
Rotation transformation
P = [x y]
= [rcos∅ rsin∅] ……(i)
Let the rotated point represented as:
P’ = [x’ y’]
= [rcos(𝜽+∅) rsin(𝜽+∅)]
= [rcos𝜽cos∅-rsin𝜽sin∅ rcos𝜽sin∅+rsin𝜽cos∅]
O∅
CAD 5
Putting the value from equation (i)
= [x cos𝜽-ysin𝜽 xsin𝜽+ycos𝜽]
This can also represented as,
= [x y] [𝑐𝑜𝑠𝜽 𝑠𝑖𝑛𝜽−𝑠𝑖𝑛𝜽 𝑐𝑜𝑠𝜽
P’ = P . R
R =𝑐𝑜𝑠𝜽 𝑠𝑖𝑛𝜽−𝑠𝑖𝑛𝜽 𝑐𝑜𝑠𝜽
……….. (anticlockwise rotation)
R’=𝑐𝑜𝑠𝜽 −𝑠𝑖𝑛𝜽𝑠𝑖𝑛𝜽 𝑐𝑜𝑠𝜽
…………(clockwise rotation)
Rotation
CAD 6
Scaling Scaling transformation alters the sizes of an object. Scaling
can be uniform or non-uniform. This scaling is occurs about the origin
Scaling transformation
• Scaling factors, sx and sy
• Uniform scaling
xsxx '
ysyy '
y
x
s
s
y
x
y
x
0
0
'
'
PSP '
x
y
x
y2xs
1ys
CAD 7
Reflection
Reflection is the same as obtaining a mirror of the original shape. This is animportant transformation and is used quite often as many engineered productsare symmetrical. The following transformation matrices as shown in below
I) Reflection about the x axis
II) Reflection about the y axis
III) Reflection relative to the coordinate origin
IV) Reflection about the line y = x
V) Reflection about the line y = -x
P’ = P . M
CAD 8
I) Reflection about the x axis
Reflection
CAD 9
II) Reflection about the y axis
Reflection
CAD 10
III) Reflection relative to the coordinate origin
Reflection
CAD 11
IV) Reflection about the line y = x
Reflection
CAD 12
V) Reflection about the line y = -x
Reflection
CAD 13
Shear
The x-direction shear relative to x axis
100
010
01 xshyshxx x '
yy '
If shx = 2:
CAD 14
The x-direction shear relative to y = yref
100
010
1 refxx yshsh)('
refx yyshxx
yy '
If shx = ½ yref = -1:
1 1/2 3/2
Shear
CAD 15
The y-direction shear relative to x = xref
100
1
001
refyy xshshxx '
yxxshy refy )('
If shy = ½ xref = -1:
1
1/2
3/2
Shear
CAD 16
Homogeneous Coordinates The use of homogeneous coordinate system is vital when there are multiple operation
which include translation, as in this coordinate system; translation is also represented asmultiplication.
Consider any point P(x y) which can be expressed as
Matrix representations
Translation =
),,(),( hyxyx hhh
xx h
h
yy h
1100
10
01
1
'
'
y
x
t
t
y
x
y
x
CAD 17
Homogeneous Coordinates
Scaling =
Rotation =
1100
00
00
1
'
'
y
x
s
s
y
x
y
x
1100
0cossin
0sincos
1
'
'
y
x
y
x
CAD 18
Composite TransformationRotation about any selected pivot point (xr,yr)
• Translate – rotate - translate
CAD 19
100
10
01
100
0cossin
0sincos
100
10
01
r
r
r
r
y
x
y
x
100
sin)cos1(cossin
sin)cos1(sincos
rr
rr
xy
yx
),,(),()(),( rrrrrr yxRyxTRyxT
Composite Transformation
CAD 20
Composite Transformation Scaling with respect to a selected fixed
position (xf,yf)
CAD 21
Composite Transformation
Translate-scale-translate
100
10
01
100
00
00
100
10
01
r
r
y
x
r
r
y
x
s
s
y
x
100
)1(0
)1(0
yfy
xfx
sys
sxs
),,,(),(),(),( rrffffyxff yxyxSyxTssSyxT
CAD 22
Example:- Perform a 45° rotation of a triangle A(0,0), B(1,1), C(5,3),(i) about the origin and(ii) about the point P(-1,-1)
Solution:-
(i) [T] = [A B C] [R]
= 0 0 11 1 15 2 1
. 𝑐𝑜𝑠𝜃 𝑠𝑖𝑛𝜃 0−𝑠𝑖𝑛𝜃 𝑐𝑜𝑠𝜃 00 0 1
When, θ = 45°
[T] =0 0 11 1 15 2 1
. 0.707 0.707 0−0.707 0.707 0
0 0 1=
0 0 10 1.414 1
2.121 4.949 1
So A’ (0,0), B’ (0,1.414), C’ (2.121,4.949)
CAD 23
(ii) [T] = [A B C] [Translation] [Rotation] [Inverse translation]
[T] = [A B C] [T] [R] [𝑇−1]
=0 0 11 1 15 2 1
.1 0 00 1 01 1 1
.𝑐𝑜𝑠45° 𝑠𝑖𝑛45° 0−𝑠𝑖𝑛45° 𝑐𝑜𝑠45° 0
0 0 1.
1 0 00 1 0−1 −1 1
=1 1 12 2 16 3 1
.0.707 0.707 0−0.707 0.707 0
0 0 1.
1 0 00 1 0−1 −1 1
=0 1.414 10 2.828 1
2.121 6.363 1.
1 0 00 1 0−1 −1 1
=−1 0.414 1−1 1.828 1
1.121 5.363 1
A” (-1, 0.414), B” (-1, 1.828), C” (1.121, 5.363)CAD 24
CAD 25