2D Rotation- Transformation in Computer Graphics

1,178 views 18 slides Jul 31, 2020
Slide 1
Slide 1 of 18
Slide 1
1
Slide 2
2
Slide 3
3
Slide 4
4
Slide 5
5
Slide 6
6
Slide 7
7
Slide 8
8
Slide 9
9
Slide 10
10
Slide 11
11
Slide 12
12
Slide 13
13
Slide 14
14
Slide 15
15
Slide 16
16
Slide 17
17
Slide 18
18

About This Presentation

A topic of transformation in Computer Graphics i.e., 2D Rotation.


Slide Content

Computer Graphics
Transformation in Computer
Graphics
Guided by- Prof. Karthikeyan S

2D- Rotation
2D Rotation is a process of rotating an object with
respect to an angle in a two dimensional plane.
This rotation is achieved by using the following
rotation equations-
1) X
new = X
old*cos θ – Y
old*sin θ
2) Y
new = X
old*sin θ + Y
old*cos θ

Question: Given a triangle with corner coordinates (0, 0), (1, 0) and
(1, 1). Rotate the triangle by 90 degree anticlockwise direction and
find out the new coordinates.
Considering:
●(0,0) to be the coordinates of point A.
●(1,0) to be the coordinates of point B.
●(1,1) to be the coordinates of point C.

Initial Triangle

Solution without calculation
C(1,1)
A(0,0)
Y
XX’
Y’

Solution without calculation
C(1,1)
A(0,0)
Y
XX’
Y’
45°
P
Q

Solution without calculation
C(1,1)
A(0,0)
Y
XX’
Y’
45°
C

C’(-x’,y’)
A(0,0)
C(1,1)
Solution without calculation
Y
XX’
Y’

C’(-x’,y’)
A(0,0)
C(1,1)
Solution without calculation
Y
XX’
Y’
P

C’(-1,1)
A(0,0)
C(1,1)
Solution without calculation
Y
XX’
Y’

C’(-1,1)
A(0,0)
C(1,1)
B(1,0)
Solution without calculation
Y
XX’
Y’

C’(-1,1)
A(0,0)
C(1,1)
B(1,0)
B’(0,1)
Y
XX’
Y’
Solution without calculation

C’(-1,1)
A(0,0)
C(1,1)
B(1,0)
B’(0,1)
Solution without calculation
Y
XX’
Y’
Triangle after
ROTATION
Given
Triangle

If we rotate the triangle ABC by an angle of 90°
then the coordinates of A, B and C would
change.
Considering the new coordinates of A, B and C
after the anticlockwise rotation to be (x’ , y’), the
new triangle would look like the image given
below:
Triangle after rotation

Finding the new coordinates of:
1) A(x’,y’)
x’= x * cos θ - y * sin θ
= 0 * cos 90° - 0 * sin 90°
= 0
y’= x * sin θ + y * cos θ
= 0 * sin 90° + 0 * cos 90°
= 0
New coordinates: A(0,0)

2) B(x’,y’)
x’= x * cos θ - y * sin θ
= 1 * cos 90° - 0 * sin 90°
= 0
y’= x * sin θ + y * cos θ
= 1 * sin 90° + 0 * cos 90°
= 1
New Coordinates: B(0,1)

3) C(x’,y’)
x’= x * cos θ - y * sin θ
= 1 * cos 90° - 1 * sin 90°
= -1
y’= x * sin θ + y * cos θ
= 1 * sin 90° + 1 * cos 90°
= 1
New Coordinates: C(-1,1)

Triangle after rotation of 90° (AC)Given triangle

Thank You