25
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. 150123119056 CAD 1

Two dimensional geometric transformation

Embed Size (px)

Citation preview

Page 1: Two dimensional geometric transformation

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

Page 2: Two dimensional geometric transformation

Contents Two Dimensional Geometric Transformation

• Translation

• Rotation

• Scaling

• Reflection

• Shear

Homogeneous Coordinates

Composite Transformation

Example

CAD 2

Page 3: Two dimensional geometric transformation

Two

Dimensional

Geometric

Transformati

on

ShearReflect

ion

Transla

-tion

Rotatio

nScaling

CAD 3

Page 4: Two dimensional geometric transformation

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

Page 5: Two dimensional geometric transformation

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

Page 6: Two dimensional geometric transformation

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

Page 7: Two dimensional geometric transformation

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

Page 8: Two dimensional geometric transformation

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

Page 9: Two dimensional geometric transformation

I) Reflection about the x axis

Reflection

CAD 9

Page 10: Two dimensional geometric transformation

II) Reflection about the y axis

Reflection

CAD 10

Page 11: Two dimensional geometric transformation

III) Reflection relative to the coordinate origin

Reflection

CAD 11

Page 12: Two dimensional geometric transformation

IV) Reflection about the line y = x

Reflection

CAD 12

Page 13: Two dimensional geometric transformation

V) Reflection about the line y = -x

Reflection

CAD 13

Page 14: Two dimensional geometric transformation

Shear

The x-direction shear relative to x axis

100

010

01 xshyshxx x '

yy '

If shx = 2:

CAD 14

Page 15: Two dimensional geometric transformation

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

Page 16: Two dimensional geometric transformation

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

Page 17: Two dimensional geometric transformation

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

Page 18: Two dimensional geometric transformation

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

Page 19: Two dimensional geometric transformation

Composite TransformationRotation about any selected pivot point (xr,yr)

• Translate – rotate - translate

CAD 19

Page 20: Two dimensional geometric transformation

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

Page 21: Two dimensional geometric transformation

Composite Transformation Scaling with respect to a selected fixed

position (xf,yf)

CAD 21

Page 22: Two dimensional geometric transformation

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

Page 23: Two dimensional geometric transformation

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

Page 24: Two dimensional geometric transformation

(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

Page 25: Two dimensional geometric transformation

CAD 25