You are on page 1of 6

Experiment 2.

Student Name: Satyam Kumar UID: 20BCA1081

Branch:  BCA                                                                        Section/Group: ON20BCA5/A

Semester:  5TH                                                                      Date of Performance:06-10-2022

Subject Name : Computer Graphic lab                                                      Subject Code: 20CAP-316

A. Task to be done: WAP to rotate a triangle using points A(200,200),


B(200,100),C(100,200) by rotation angle 45 degree.

B. Steps of Experiment:

1. Enter the coordinates of triangle:

A (200,200), B (200,100), C (100,200).

2. Put coordinates:

line(x1,y1,x2,y2);

line(x2,y2,x3,y3);

line(x3,y3,x1,y1);

3. Enter the rotation angle:

c = cos(angle * PI /180);

s = sin(angle * PI /180);

4. Rotate the triangle using:


x1 = floor(x1 * c + y1 * s);

y1 = floor(-x1 * s + y1 * c);

x2 = floor(x2 * c + y2 * s);

y2 = floor(-x2 * s + y2 * c);

x3 = floor(x3 * c + y3 * s);

y3 = floor(-x3 * s + y3 * c);

5. End.

C=Cos
S=Sin
X1,y1,x2,y2,x3,y3 = Coordinates of triangle

C. Steps For Experiment/ Practical:


D. Output
Learning outcomes (What I have learnt):

1. I learn how to make triangle.

2. I learn about the rotation of the triangle.

3. I learn how to find coordinates using cos and sin, rotation, translation, matrix.
Evaluation Grid:

Sr. No. Parameters Marks Obtained Maximum Marks


1. Demonstration and Performance 5
(Pre Lab Quiz)
2. Worksheet 10
3. Post Lab Quiz 5

You might also like