A topic of transformation in Computer Graphics i.e., 2D Rotation.
Size: 109.7 KB
Language: en
Added: Jul 31, 2020
Slides: 18 pages
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)