0% found this document useful (0 votes)
8 views54 pages

Cglab

This document is a lab manual for the Computer Graphics course (22CSH-352/22ITH-352) for B.E. CSE students at Chandigarh University, covering the academic session from January to June 2025. It outlines the university and department's vision and mission, program educational objectives, course objectives, outcomes, and a detailed syllabus including experiments and assessments. The manual emphasizes practical knowledge and skills in computer graphics, including algorithms, transformations, and interactive graphics applications.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views54 pages

Cglab

This document is a lab manual for the Computer Graphics course (22CSH-352/22ITH-352) for B.E. CSE students at Chandigarh University, covering the academic session from January to June 2025. It outlines the university and department's vision and mission, program educational objectives, course objectives, outcomes, and a detailed syllabus including experiments and assessments. The manual emphasizes practical knowledge and skills in computer graphics, including algorithms, transformations, and interactive graphics applications.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 54

Department of Computer Science &

Engineering
SUBJECT: Computer graphics with Lab
(22CSH-352/22ITH-352)

BATCH: B.E. CSE (2022-2026)

B.E. III Year – VI Semester

ACADEMIC SESSION (JAN-JUNE 2025)

LAB MANUAL

Chandigarh University
Gharuan, Mohali

Prepared By: Verified By: HOD Sign:


CONTENTS

Sr.
Particular Page No.
No.

1 University-Vision and Mission I

2 Department-Vision and Mission Ii

3 PEO/POs/SOs/PSOs iii-vi

4 Code of Ethics Vii

Syllabus (As approved in BOS) - Course Objectives, Course Outcomes,


5 viii-xii
Mapping of COs/POs/PSOs/SOs

6 List of Experiments (Mapped with COs) Xiii

Detail of Experiments

Aim

Objective

7 Input/Apparatus Used
1-124
Procedure/Algorithm/Code

Observations/Outcome

Discussion

Question: Viva Voce


Instructions and Precautions Measures for Lab

Department of Computer Science & Engineering

i
University-Vision and Mission

Vision of the University


To be globally recognized as a Centre of Excellence for Research, Innovation,
Entrepreneurship and disseminating knowledge by providing inspirational learning to produce
professional leaders for serving the society

Mission of the University


Providing world class infrastructure, renowned academicians and ideal environment for
Research, Innovation, Consultancy and Entrepreneurship relevant to the society.

Offering programs & courses in consonance with National policies for nation building and
meeting global challenges.

Designing Curriculum to match International standards, needs of Industry, civil society and for
inculcation of traits of Creative Thinking and Critical Analysis as well as Human and Ethical
values.

Ensuring students delight by meeting their aspirations through blended learning, corporate
mentoring, professional grooming, flexible curriculum and healthy atmosphere based on co-
curricular and extra-curricular activities.

Creating a scientific, transparent and objective examination/evaluation system to ensure an


ideal certification.

Establishing strategic relationships with leading National and International corporates and
universities for academic as well as research collaborations.

Contributing for creation of healthy, vibrant and sustainable society by involving in


Institutional Social Responsibility (ISR) activities like rural development, welfare of senior
citizens, women empowerment, community service, health and hygiene awareness and
environmental protection

Department of Computer Science & Engineering

ii
Department-Vision and Mission

Vision of the Department

To be recognized as a leading Computer Science and Engineering department through effective


teaching practices and excellence in research and innovation for creating competent
professionals with ethics, values and entrepreneurial attitude to deliver service to society and
to meet the current industry standards at the global level.

Mission of the Department

M1: To provide practical knowledge using state-of-the-art technological support for the
experiential learning of our students.

M2: To provide industry recommended curriculum and transparent assessment for quality
learning experiences.

M3: To create global linkages for interdisciplinary collaborative learning and research.

M4: To nurture advanced learning platform for research and innovation for students’ profound
future growth.

M5: To inculcate leadership qualities and strong ethical values through value based education.

Department of Computer Science & Engineering

iii
PEO Program Educational Objectives (PEOs)

Program Educational Objectives (PEOs)

The Program Educational Objectives of the Computer Science & Engineering undergraduate
program are for graduates to achieve the following, within few years of graduation. The
graduates of Computer Science & Engineering Program will

PEO1: Engage in successful careers in industry, academia, and public service, by applying the
acquired knowledge of Science, Mathematics and Engineering, providing technical leadership
for their business, profession and community.

PEO2: Establish themselves as entrepreneur, work in research and development organization


and pursue higher education.

PEO3: Exhibit commitment and engage in lifelong learning for enhancing their professional
and personal capabilities.

Department of Computer Science & Engineering

iv
PO Program Outcomes (PO's)

Program Outcomes(PO's)

Engineering Graduates will be able to:


PO 1. Engineering knowledge: Apply the knowledge of mathematics, science, engineering
fundamentals, and an engineering specialization to the solution of complex engineering
problems.
PO 2. Problem analysis: Identify, formulate, review research literature, and analyze complex
engineering problems reaching substantiated conclusions using first principles of mathematics,
natural sciences, and engineering sciences.
PO 3. Design/development of solutions: Design solutions for complex engineering problems
and design system components or processes that meet the specified needs with appropriate
consideration for the public health and safety, and the cultural, societal, and environmental
considerations.
PO 4. Conduct investigations of complex problems: Use research-based knowledge and
research methods including design of experiments, analysis and interpretation of data, and
synthesis of the information to provide valid conclusions.
PO 5. Modern tool usage: Create, select, and apply appropriate techniques, resources, and
modern engineering and IT tools including prediction and modeling to complex engineering
activities with an understanding of the limitations.
PO 6. The engineer and society: Apply reasoning informed by the contextual knowledge to
assess societal, health, safety, legal and cultural issues and the consequent responsibilities
relevant to the professional engineering practice.
PO 7. Environment and sustainability: Understand the impact of the professional engineering
solutions in societal and environmental contexts, and demonstrate the knowledge of, and need
for sustainable development.
PO 8. Ethics: Apply ethical principles and commit to professional ethics and responsibilities
and norms of the engineering practice.
PO 9. Individual and team work: Function effectively as an individual, and as a member or
leader in diverse teams, and in multidisciplinary settings.
PO 10. Communication: Communicate effectively on complex engineering activities with the
engineering community and with society at large, such as, being able to comprehend and write
effective reports and design documentation, make effective presentations, and give and receive
clear instructions.
PO 11. Project management and finance: Demonstrate knowledge and understanding of the
engineering and management principles and apply these to one’s own work, as a member and
leader in a team, to manage projects and in multidisciplinary environments.

PO 12. Life-long learning: Recognize the need for, and have the preparation and ability to
engage in independent and life-long learning in the broadest context of technological change.

Department of Computer Science & Engineering

v
Program Specific Outcomes (PSOs)
A Graduate of Computer Science and Engineering Program will be able:

PSO 1. Exhibit attitude for continuous learning and deliver efficient solutions for emerging
challenges in the computation domain.

PSO 2. Apply standard software engineering principles to develop viable solutions for
Information Technology Enabled Services (ITES).

Department of Computer Science & Engineering

vi
Student Outcomes
The Bachelor of Engineering is a program offered by the Department of Computer Science &
Engineering in accordance with the Student Outcome of Computing Accreditation
Commission (CAC) and Engineering Accreditation Commission (EAC) of ABET. The
Student Outcomes are as follows:

Student Outcomes according to Computing Accreditation Commission (CAC)

SO 1. Analyze a complex computing problem and apply principles of computing and other
relevant disciplines to identify solutions.
SO 2. Design, implement and evaluate a computing-based solution to meet a given set of
computing requirements in the context of the program’s discipline.
SO 3. Communicate effectively in a variety of professional contexts.
SO 4. Recognize professional responsibilities and make informed judgments in computing
practice based on legal and ethical principles.
SO 5. Function effectively as a member or leader of a team engaged in activities appropriate
to the program’s discipline.
SO 6. Apply computer science theory and software development fundamentals to produce
computing-based solutions.

Student Outcomes according to Engineering Accreditation Commission (EAC)

SO 1. An ability to identify, formulates, and solve complex engineering problems by


applying principles of engineering, science, and mathematics
SO 2. An ability to apply engineering design to produce solutions that meet specified needs
with consideration of public health, safety, and welfare, as well as a global, cultural, social,
environmental, and economic factor
SO 3. An ability to communicate effectively with a range of audiences
SO 4. An ability to recognize ethical and professional responsibilities in engineering
situations and make informed judgments, which must consider the impact of engineering
solutions in global, economic, environmental, and societal contexts
SO 5. An ability to function effectively on a team whose members together provide
leadership, create a collaborative and inclusive environment, establish goals, plan tasks, and
meet objectives.
SO 6. An ability to develop and conduct appropriate experimentation, analyze and interpret
data, and use engineering judgment to draw conclusions.
SO 7. An ability to acquire and apply new knowledge as needed, using appropriate learning.

Department of Computer Science & Engineering

vii
CODE OF ETHICS
1. I will respect my teachers, university staff and elders and I will support and help
younger ones

2. I will never indulge in ragging and destructive/negative activities.

3. I will love my institution and work for its improvement. I will not criticize for minor
shortcomings. I will become a good example as human being in the society. I will
keep campus clean and not damage university property.

4. I will remain regular in attending university. I will never bunk classes. It is only on
urgent occasions that I will seek permission to go home. I will not be absent from
university because of petty reasons like headache, sleep, minor temperature etc.

5. I will do my home work daily and regularly. I understand that not doing homework
regularly lead to many problems like inefficiency, tensions and poor results. My room
at home will have sufficient books and learning material right from the beginning of
semester/year.

6. I will return Library book in time. I will not damage them, keep them neat and clean.
I will regularly visit library during spare time. I will make full use of labs and other
resources.

7. I will wear university I-Card and obey dress code decided by university from time to
time.

8. I will utilize my vacation for extra coaching, writing papers, educational articles and
personality development work and will not waste them.

9. I will watch TV, News, read Newspapers, technical magazines and keep myself aware
about the happenings in the rest of the world. I will use Internet for learning and
exploring opportunities.

10. I will not waste hard earned money of my parents. I will never bring outlay gadgets
to university to impress my university mates.

11. I will decide my goals and work toward achieving them.

12. I will not indulge in cheating or any unfair means while appearing in my exams
/interviews.

13. I will take part in sports and other co-curricular activities regularly and I will take part
in various schemes for the welfare of the society like blood donation, tree plantation
and adult education.

Department of Computer Science & Engineering

viii
Syllabus

Program Code-CS201, Course Title: Computer Graphics with


L T P C CH
CS202, CS703, CS704, Lab
IT201, IT202, BI519
Subject Code Prerequisite: Basics of Computers and
:22CSH-352/22ITH-352 C/C++, Linear algebra, Matrices
3 0 2 4 5
Co-Requisite---NA
Anti-Requisite---NA

a. Course Description:
This course provides an in-depth understanding of the fundamental principles, algorithms, and applications of computer
graphics. It introduces students to the hardware and software aspects of graphical systems, emphasizing the design and
implementation of interactive graphical environments. The course explores key topics such as scan conversion,
transformations, clipping, 3D graphics, and hidden surface elimination, equipping students with the theoretical and
practical knowledge needed to develop graphic-rich applications.

b. Course Objectives:

● Understand the fundamentals and origins of computer graphics systems.


● Implement algorithms for line drawing, circle generation, and 2D/3D transformations.
● Apply clipping and windowing techniques to graphical applications.
● Explore interactive graphics using input/output devices and software principles.
● Learn 3D graphics, curves, surfaces, and hidden surface elimination methods.

c. Course Outcome

Describe the fundamental concepts of computer graphics, including display systems and
CO1 transformations.

Apply line and circle drawing algorithms, transformations, and clipping techniques in practical
CO2 scenarios.

Analyze the efficiency and accuracy of graphical algorithms like DDA, Bresenham's, and Cohen-
CO3 Sutherland.

Evaluate the outcomes of transformations and clipping operations, and interpret their visual results.
CO4

Develop interactive graphics applications using advanced techniques like Bezier curves and
CO5 graphical input devices.

UNIT 1 15 Hours

Introduction: Origins of Computer Graphics, Interactive Graphics display working, Scan conversion; Raster and
Random scan conversion. Point plotting techniques: Coordinate systems, Incremental methods, Line drawing
algorithms: Simple DDA, Symmetrical DDA, Bresenham’s algorithm. Midpoint circle drawing algorithm, Circle
generators.

Line Drawing Displays: Display devices and Controllers, CRT, Inherent memory devices, Storage tube display,

Department of Computer Science & Engineering

ix
Refresh line drawing displays.
2-D Transformations: Transformation principles, Homogeneous coordinate systems, Concatenations, Matrix
representations of transformations.

Experiment Demonstrate the use of graphics.h functions to draw basic shapes like lines, triangles, and
1.1 circles.

Experiment Implement and compare the performance of Simple DDA, Symmetrical DDA, and
1.2 Bresenham’s algorithm for line drawing.

Experiment Apply translation, scaling, and rotation transformations on a given triangle and observe the
1.3 changes.

Experiment a) Develop a program to draw a circle using the circle generator algorithm for a given center
1.4 and radius.
b) Develop a program to draw a circle using the midpoint circle algorithm for a given center
and radius.

Unit 2 15 Hours
Clipping and Windowing: Point clipping, Line clipping algorithms: Cohen Sutherland algorithm, Midpoint
subdivision algorithm. Polygon clipping, Viewing transformations, Windowing transformations.
Graphics Packages: Ground rules for graphics software design, Functional domains, Graphic primitives,
Windowing functions, miscellaneous functions, Display code generator.
Interactive Graphics: Graphical input devices: Pointing and Positioning devices, Mouse, Tablets, light pen, 3-D
Input devices, Comparators. Graphical input techniques: Positioning techniques, pointing and Selection, Inking
and Painting, On-line character recognition.

Experiment Implement clockwise and anticlockwise rotation of a triangle about a specified point and
2.1 evaluate the results.
Experiment Analyze and implement the reflection of a point about a line defined by the equation y=mx+c.
2.2
Experiment Evaluate the 4-bit region code for line endpoints and determine whether the line lies inside or
2.3 outside the viewport.

Unit 3 15 Hours
Solid Area Scan Conversion: Geometric representation of areas, Scan converting polygons, Priority, The Y-X
algorithm, Properties of scan conversion algorithms.
Graphics: Curves and Surfaces: Parametric functions, Bezier methods and B-Spline methods. Three dimensional
transformations, Perspective transformations, Perspective depth.
Hidden Surface Elimination: Basic approaches, Depth –Buffer algorithm, Scan line coherence algorithms, Area
coherence algorithms, Priority algorithms.

Experiment a) Apply the Cohen-Sutherland Line Clipping algorithm to clip a line intersecting at one
3.1 point with a given window.
b) Apply the Cohen-Sutherland Line Clipping algorithm to clip a line intersecting at two
or more points with a given window

Department of Computer Science & Engineering

x
Experiment Demonstrate the result of window-to-viewport transformation by implementing and visualizing
3.2 the process.

Experiment Lab Based Mini Project


3.3

d. Text Books:

• Newman, William M., Sproull, Robert F., “Principles of Interactive Computer Graphics”, Tata
McGraw Hill Company, 2ndEdition.
• Hearn, D., Baker M. P. ,”Computer Graphics”, Pearsoneducation.
• Xiang Z., Plastock R., “ Computer Graphics”, Schaum’s outlines, Tata Mcgraw Hill Companies.

e. Reference Books:

• Harrington, S., “Computer Graphics: A Programming Approach”, Tata McGrawHill.


Roggers, D.F., “Procedural Elements for Computer Graphics”, Tata McGrawHill.

CO-PO Mapping

Course PO1 PO2 PO3 PO4 PO5 PO6 PO7 PO8 PO9 PO1 PO1 PO12

PSO

PSO
Outcome 0 1

2
CO1 3 2 1 1 1 - - - - 1 - 2 2 -
CO2 3 3 2 2 2 - - - - - - 2 - -
CO3 3 3 2 3 2 - - - - 1 - 2 2 -
CO4 2 3 2 3 2 1 - - - - - - - 2
CO5 3 2 3 3 3 1 - - 2 2 2 3 - -
AVG 2.8 2.6 2 2.4 2 1 - - 2 1.3 2 2.25 2 2

Department of Computer Science & Engineering

xi
List of Experiments (Mapped with Cos)

Experiment Experiment Name Mapped with


No CO
Experiment 1 Demonstrate the use of graphics.h functions to draw basic CO1
shapes like lines, triangles, and circles.

Experiment 2 Implement and compare the performance of Simple CO2, CO3


DDA, Symmetrical DDA, and Bresenham’s algorithm for
line drawing.

Experiment 3 Apply translation, scaling, and rotation transformations on CO2, CO4


a given triangle and observe the changes.

Experiment 4 a) Develop a program to draw a circle using the circle CO2, CO3
generator algorithm for a given center and radius.

b) Develop a program to draw a circle using the midpoint


circle algorithm for a given center and radius.

Experiment 5 Implement clockwise and anticlockwise rotation of a CO2, CO3


triangle about a specified point and evaluate the results.

Experiment 6 Analyze and implement the reflection of a point about a CO3, CO4
line defined by the equation y=mx+c.

Experiment 7 Evaluate the 4-bit region code for line endpoints and CO2, CO4
determine whether the line lies inside or outside the
viewport.

Experiment 8 a) Apply the Cohen-Sutherland Line Clipping algorithm to clip a CO4, CO5
line intersecting at one point with a given window.
b) Apply the Cohen-Sutherland Line Clipping algorithm to clip a
line intersecting at two or more points with a given window

Experiment 9 Demonstrate the result of window-to-viewport CO4, CO5


transformation by implementing and visualizing the
process.

Experiment Lab Based Mini Project CO1, CO2, CO3,


10 CO4, CO5

Department of Computer Science & Engineering

xii
Experiment 1:
AIM: Demonstrate the use of graphics.h functions to draw basic shapes like lines, triangles, and circles.
Objective: To familiarize students with using the graphics.h library to create basic shapes like lines, triangles, and circles.

Code: #include<iostream.h>
#include<conio.h>
#include<graphics.h>
void main()
{
clrscr();
int gd=DETECT,gm;
initgraph(&gd,&gm,"c:\\turboc3\\bgi");
setbkcolor(2);
circle(100,100,50);
outtextxy(75,98,"CIRCLE");
rectangle(210,60,400,140);
outtextxy(270,100,"RECTANGLE");
line(455,85,555,85);
outtextxy(490,95,"LINE");
arc(80,350,10,80,100);
outtextxy(100,340,"ARC");
ellipse(380,300,0,360,40,80);
outtextxy(355,300,"ELLIPSE");
getch();
}

Output:

Department of Computer Science & Engineering Page 13


Viva Questions:
1. Define graphics.h, and why is it used?
2. How do you initialize the graphics mode in C/C++?
3. List the functions to draw lines, circles, and triangles in graphics.h?
4. How do you set the color of a shape in graphics.h?
5. Differentiate between putpixel() and line() functions?

Department of Computer Science & Engineering Page 14


Experiment-2
Aim Implement and compare the performance of Simple DDA, Symmetrical DDA, and Bresenham’s
algorithm for positive and negative line slope.

a) DDA
A digital differential analyzer (DDA) is hardware or software used for linear interpolation of variables over
an interval between start and end point. DDAs are used for rasterization of lines, triangles and polygons. In its simplest
implementation, the DDA algorithm interpolates values in interval by computing for each xi in the equations.

Code:-
#include<iostream.h>
#include<dos.h>
#include<conio.h>
#include<math.h>
#include<graphics.h>
#define round(a) ((int)(a+0.5))
void dda_line(int x1,int y1,int x2,int y2)
{
int dx=(x2-x1);
int dy=(y2-y1);
int length;
if(abs(dy)>abs(dx))
length=abs(dy);
else
length=abs(dx);
float xinc,yinc,x=x1,y=y1;
xinc=dx/(float)length;
yinc=dy/(float)length;

putpixel(round(x),round(y),15);
for(int k=1;k<=length;k++)
{
x=x+xinc;
y=y+yinc;
putpixel(round(x),round(y),15);
delay(100);
}
}
void main()
{
clrscr();
int x1,x2,y1,y2;
int gd=DETECT,gm;
cout<<"Enter the x-coordinate of starting point : ";
cin>>x1;
cout<<"Enter the y-coordinate of ending point : ";
cin>>y1;
Department of Computer Science & Engineering Page 15
cout<<endl;
cout<<"Enter the x-coordinate of starting point : ";
cin>>x2;
cout<<"Enter the y-coordinate of ending point : ";
cin>>y2;
getch();
initgraph(&gd,&gm,"c:\\turboc3\\bgi");
dda_line(x1,y1,x2,y2);
setcolor(4);
getch();
closegraph();

b) Using Symmetrical DDA.


#include<conio.h>
#include<iostream.h>
#include<graphics.h>
#include<dos.h>
#include<math.h>
#define ROUND(a)((int)(a+0.5))
void symDDA(int xa,int ya,int xb,int yb)
{
int dx=xb-xa,dy=yb-ya;float length;
float xinc,yinc,x=xa,y=ya;
if(abs(dx)>abs(dy))

length=abs(dx);
Department of Computer Science & Engineering Page 16
else
length=abs(dy);
float n=log10(length)/log10(2);
xinc=dx/(pow(2,n));
yinc=dy/(pow(2,n));
putpixel(ROUND(x),ROUND(y),15);
delay(50);
for(int i=0;i<length;i++)
{
x=x+xinc;
y=y+yinc;
putpixel(ROUND(x),ROUND(y),15);
delay(50);
}
}
void main()
{
int gd=DETECT,gm;
initgraph(&gd,&gm,"");
int xa,xb,ya,yb;
cout<<"enter the points";
cin>>xa>>xb>>ya>>yb;
cleardevice();
symDDA(xa,xb,ya,yb);
getch();
closegraph();
}

c) Using bresenham’s algorithm


Code:-
#include<iostream.h>
#include<conio.h>
#include<graphics.h>
#include<math.h>
#include<dos.h>
int sign(int x)
{
if(x<0)
return(-1);
if(x>0)
return(1);
else
return(0);
}

Department of Computer Science & Engineering Page 17


void lineBres(int xa,int ya,int xb,int yb)
{
int sx,sy,t,length,flag;
int x=xa;
int y=ya;
int dx=abs(xa-xb),dy=abs(ya-yb);
sx=sign(xb-xa);
sy=sign(yb-ya);
if(dy>dx)
{
t=dx;
dx=dy;
dy=t;
length=dy;
flag=1;
}
else
{
length=dx;
flag=0;
}
int p=(2*dy)-dx;
int twoDx=2*dx,twoDy=2*dy;
putpixel(x,y,15);
delay(50);
for(int i=0;i<length;i++)
{
while(p>0)
{
if(flag==1)
x=x+sx;
else
y=y+sy;
p=p-twoDx;
}
if(flag==1)
y=y+sy;
else
{
x=x+sx;
p=p+twoDy;
putpixel(x,y,15);
delay(50);
}
}
}
void main()
Department of Computer Science & Engineering Page 18
{
int gd=DETECT,gm;
initgraph(&gd,&gm,"c://turboc3//bgi");
int xa,ya,xb,yb;
cout<<"Enter the starting point of x :";
cin>>xa;
cout<<"Enter the starting point of y :";
cin>>ya;
cout<<"Enter the ending point of x :";
cin>>xb;
cout<<"Enter the ending point of x :";
cin>>yb;
cleardevice();
lineBres(xa,ya,xb,yb);
getch();
closegraph();
}

Viva Questions:
Q1: Differentiate between Simple DDA, Symmetrical DDA, and Bresenham’s Algorithm.
Q2: Why is Bresenham’s algorithm considered more efficient than DDA?
Q3: List the role of floating-point arithmetic in DDA?
Q4: How does the midpoint criteria work in Bresenham’s algorithm?
Q5: List the advantages of Symmetrical DDA over Simple DDA?

Department of Computer Science & Engineering Page 19


Experiment 3
Aim: Apply translation, scaling, and rotation transformations on a given triangle and observe the changes.
Objective: To apply geometric transformations such as translation, scaling, and rotation on a given triangle.
a) Translation
Code:
#include<iostream.h>
#include<conio.h>
#include<graphics.h>
void main()
{
clrscr();
int gd=DETECT,gm;
initgraph(&gd,&gm,"c://turboc3//bgi");
int x1=100,y1=100,x2=80,y2=150,x3=120,y3=150,tx,ty;
line(x1,y1,x2,y2);
line(x2,y2,x3,y3);
line(x3,y3,x1,y1);
cout<<"Enter translation value among x-axis :";
cin>>tx;
cout<<"Enter translation value among y-axis :";
cin>>ty;
x1+=tx;x2+=tx;x3+=tx;
y1+=ty;y2+=ty;y3+=ty;
line(x1,y1,x2,y2);
line(x2,y2,x3,y3);
line(x3,y3,x1,y1);
getch();
}

Output:

Department of Computer Science & Engineering Page 20


b) Scaling

Code:
#include<iostream.h>
#include<conio.h>
#include<graphics.h>
void main()
{
clrscr();
int gd=DETECT,gm;
initgraph(&gd,&gm,"c://turboc3//bgi");
int x1=100,y1=100,x2=80,y2=150,x3=120,y3=150,sx,sy;
line(x1,y1,x2,y2);
line(x2,y2,x3,y3);
line(x3,y3,x1,y1);
cout<<"Enter scaling value among x-axis :";
cin>>sx;
cout<<"Enter scaling value among y-axis :";
cin>>sy;
x1*=sx; x2*=sx; x3*=sx;
y1*=sy; y2*=sy; y3*=sy;
line(x1,y1,x2,y2);
line(x2,y2,x3,y3);
line(x3,y3,x1,y1);
getch();
}

Output:

Department of Computer Science & Engineering Page 21


c) Transformation
Code
#include<iostream.h>
#include<conio.h>
#include<math.h>
#include<graphics.h>
void main()
{
clrscr();
int gd=DETECT,gm;
initgraph(&gd,&gm,"c://turboc3//bgi");
int x1=200,y1=200,x2=180,y2=250,x3=220,y3=250;
float angle;
line(x1,y1,x2,y2);
line(x2,y2,x3,y3);
line(x3,y3,x1,y1);
cout<<"Enter the rotation angle : ";
cin>>angle;
angle=angle*3.1428/180;
x1=x1*cos(angle)-y1*sin(angle);
y1=(x1*sin(angle))+y1*cos(angle);
x2=x2*cos(angle)-y2*sin(angle);
y2=(x2*sin(angle))+y2*cos(angle);
x3=x3*cos(angle)-y3*sin(angle);
y3=(x3*sin(angle))+y3*cos(angle);
line(x1,y1,x2,y2);
line(x2,y2,x3,y3);
line(x3,y3,x1,y1);
getch();
}

Viva Questions:
Q1: Define homogeneous transformation matrix.
Q2: How do you perform translation mathematically?
Q3: Differentiate between scaling with respect to origin vs. scaling with respect to a point?
Q4: Define rotation matrix, and how does clockwise rotation differ from anticlockwise rotation?
Q5: How do you apply multiple transformations together?

Department of Computer Science & Engineering Page 22


Experiment 4
AIM:
a) Develop a program to draw a circle using the circle generator algorithm for a given center and radius.
b) Develop a program to draw a circle using the midpoint circle algorithm for a given center and radius.

Objective:
To develop and implement the circle generator and midpoint circle generator algorithm to draw a circle with
a given center and radius.
a) Mid point circle Algorithm:
Code:
#include<iostream.h>
#include<conio.h>
# include<graphics.h>
#include<math.h>
#include<dos.h>
#define round(a) ((int)a+0.5)
void putcircle(int xc,int yc,int x,int y)
{
putpixel(xc+x,yc+y,1);
putpixel(xc-x,yc+y,2);
putpixel(xc+x,yc-y,3);
putpixel(xc-x,yc-y,4);
putpixel(xc+y,yc+x,5);
putpixel(xc-y,yc+x,6);
putpixel(xc+y,yc-x,7);
putpixel(xc-y,yc-x,8);
}
void circlemid(int xc,int yc,float r)
{
float x=0,y=r;
int p=1-r;
while(x<y)
{
x++;
if(p<0)
p=p+(2*x)+1;
else
{
y--;
p=p+(2*(x-y)+1);
}
putcircle(xc,yc,round(x),round(y));
delay(10);
}
}

Department of Computer Science & Engineering Page 23


void main()
{
clrscr();
int gd=DETECT,gm;
initgraph(&gd,&gm," ");
int xc,yc,r;
cout<<"Enter centre co-ordinates:";
cin>>xc>>yc;
cout<<"Enter radius:";
cin>>r;
circlemid(xc,yc,r);
setcolor(10);
circle(xc,yc,r);
getch();
closegraph();
}
OUTPUT

b) Circle Generator algorithm:


Code:
#include<iostream.h>
#include<conio.h>
#include<dos.h>
#include<graphics.h>
#include<math.h>
#define round(a) ((int)(a+0.5))
void main()
{
Department of Computer Science & Engineering Page 24
clrscr();
int gd=DETECT,gm;
initgraph(&gd,&gm,"");

// METHOD1
int xc=100,yc=150,r=50;
float x=0,y=0;
for(int i=0;i<=45;i++)
{
double ang=double(i)*(3.142/180);
x = r*cos(ang);
y = r*sin(ang);
putpixel(xc+round(x),yc+round(y),15);
putpixel(xc-round(x),yc+round(y),15);
putpixel(xc+round(x),yc-round(y),15);
putpixel(xc-round(x),yc-round(y),15);
putpixel(xc+round(y),yc+round(x),15);
putpixel(xc-round(y),yc+round(x),15);
putpixel(xc+round(y),yc-round(x),15);
putpixel(xc-round(y),yc-round(x),15);
delay(100);
}

//METHOD2
x=0;y=r;
xc=300,yc=150;
for(x=0;x<y;x++)
{
double temp=((r*r)-(x*x));
y=sqrt(temp);
putpixel(xc+round(x),yc+round(y),15);
putpixel(xc-round(x),yc+round(y),15);
putpixel(xc+round(x),yc-round(y),15);
putpixel(xc-round(x),yc-round(y),15);
putpixel(xc+round(y),yc+round(x),15);
putpixel(xc-round(y),yc+round(x),15);

putpixel(xc+round(y),yc-round(x),15);
putpixel(xc-round(y),yc-round(x),15);
delay(100);
}
getch();
closegraph();
}

Department of Computer Science & Engineering Page 25


Output:

Viva Questions:
Q1: Differentiate between the circle generator algorithm and the midpoint circle algorithm?
Q2: Why do we calculate only one-eighth of the circle in the midpoint algorithm?
Q3: Define the role of decision parameter in the midpoint circle algorithm?
Q4: List the advantages of the midpoint circle algorithm over the Bresenham’s circle algorithm?
Q5: How do you modify the algorithm to draw an ellipse instead of a circle?

Department of Computer Science & Engineering Page 26


Experiment-5
Aim: Implement clockwise and anticlockwise rotation of a triangle about a specified point and evaluate the
results.
Objective: To perform and visualize clockwise and anticlockwise rotations of a triangle about a specified
point.
(a) To rotate clockwise

Code:-

#include<iostream.h>
#include<conio.h>
#include<graphics.h>
#include<math.h>
void main()
{
clrscr();
int gd=DETECT,gm;
initgraph(&gd,&gm,"");
int x1,y1,x2,y2,x3,y3;
cout<<"Enter (x1,y1),(x2,y2),(x3,y3) for triangle : ";
cin>>x1>>y1>>x2>>y2>>x3>>y3;
int a[]={x1,y1,x2,y2,x3,y3,x1,y1};
drawpoly(4,a);
int xf=(x1+x2+x3)/3;
int yf=(y1+y2+y3)/3;
float ang;
cout<<"Enter the rotation angle :";
cin>>ang;
float rad=ang*3.1428/180;
int X1=(x1-xf)*cos(rad)-(y1-yf)*sin(rad)+xf;
int Y1=(x1-xf)*sin(rad)+(y1-yf)*cos(rad)+yf;
int X2=(x2-xf)*cos(rad)-(y2-yf)*sin(rad)+xf;
int Y2=(x2-xf)*sin(rad)+(y2-yf)*cos(rad)+yf;
int X3=(x3-xf)*cos(rad)-(y3-yf)*sin(rad)+xf;
int Y3=(x3-xf)*sin(rad)+(y3-yf)*cos(rad)+yf;
int b[]={X1,Y1,X2,Y2,X3,Y3,X1,Y1};
drawpoly(4,b);
getch();
}

Department of Computer Science & Engineering Page 27


(a) To rotate anti-clockwise

Code:-
#include<iostream.h>
#include<conio.h>
#include<graphics.h>
#include<math.h>
void main()
{
clrscr();
int gd=DETECT,gm;
initgraph(&gd,&gm,"");
int x1,y1,x2,y2,x3,y3;
cout<<"Enter (x1,y1),(x2,y2),(x3,y3) for triangle : ";
cin>>x1>>y1>>x2>>y2>>x3>>y3;
int a[]={x1,y1,x2,y2,x3,y3,x1,y1};
drawpoly(4,a);
int xf=(x1+x2+x3)/3;
int yf=(y1+y2+y3)/3;
float ang;
cout<<"Enter the rotation angle :";
cin>>ang;
float rad=ang*3.1428/180;
int X1=(x1-xf)*cos(rad)+(y1-yf)*sin(rad)+xf;
int Y1=-(x1-xf)*sin(rad)+(y1-yf)*cos(rad)+yf;
int X2=(x2-xf)*cos(rad)+(y2-yf)*sin(rad)+xf;
int Y2=-(x2-xf)*sin(rad)+(y2-yf)*cos(rad)+yf;
int X3=(x3-xf)*cos(rad)+(y3-yf)*sin(rad)+xf;
int Y3=-(x3-xf)*sin(rad)+(y3-yf)*cos(rad)+yf;
int b[]={X1,Y1,X2,Y2,X3,Y3,X1,Y1};
drawpoly(4,b);
getch();
}

Department of Computer Science & Engineering Page 28


Viva Questions:
Q1: What is the mathematical formula for 2D rotation?
Q2: How do you rotate a triangle about an arbitrary point?
Q3: What happens when a triangle is rotated by 90°, 180°, and 270°?
Q4: How does clockwise rotation differ from anticlockwise rotation?
Q5: What happens to a shape if the scaling factor is negative during transformation?

Department of Computer Science & Engineering Page 29


Experiment-6
Aim: Analyze and implement the reflection of a point about a line defined by the equation y=mx+c.
Objective: To implement and analyze the reflection of a point about a straight line defined by the equation
y=mx+c.

Code:
#include<iostream.h>
#include<conio.h>
#include<graphics.h>

void main()
{
int gd=DETECT,gm;
initgraph(&gd,&gm," ");
int x1,y1,x2,y2;
cout<<"Enter the coordinates of the line\n";
cin>>x1>>y1>>x2>>y2;
int m=getmaxx();
int n=getmaxy();
setcolor(6);
line(x1,y1,x2,y2);
outtextxy(x1,y1+10,"Original Object");
setcolor(4);
line((m/2),0,(m/2),n);
line(0,(n/2),m,(n/2));
setcolor(3);
int c=(n/2)-y1;
int d=(n/2)-y2;
y2=y2+(d*2);
y1=y1+(c*2);
line(x2,y2,x1,y1);
outtextxy(x1,y1+10,"Reflection along X-axis");
setcolor(9);
int a=(m/2)-x1;
int b=(m/2)-x2;
x1=x1+(a*2);
x2=x2+(b*2);
line(x1,y1,x2,y2);
outtextxy(x2-20,y2+10,"Reflection along Y-axis");
getch();
closegraph();
}

Department of Computer Science & Engineering Page 30


Output:

Viva Questions:
Q1: What is the formula to reflect a point about x-axis, y-axis, and origin?
Q2: How do you reflect a point about a line of the form y = mx + c?
Q3: What happens if the line is y = x or y = -x?
Q4: Can reflection be performed using a single matrix transformation?
Q5: What is the difference between reflection and rotation?

Department of Computer Science & Engineering Page 31


Experiment-7
Aim: Evaluate the 4-bit region code for line endpoints and determine whether the line lies inside or outside
the screen.
Objective: To calculate and display the 4-bit region code for line endpoints and determine whether the line
lies within the screen boundaries.

Code:
#include<iostream.h>
#include<conio.h>
#include<graphics.h>
void main()
{
int gd=DETECT,gm;
initgraph(&gd,&gm,NULL);
int xmax=400,ymax=300,xmin=200,ymin=150;
line(xmin,0,xmin,getmaxy());
line(xmax,0,xmax,getmaxy());
line(0,ymax,getmaxx(),ymax);
line(0,ymin,getmaxx(),ymin);
cout<<"Enter the endpoints of the line :";
int x[2],y[2],num[2];
cin>>x[0]>>y[0]>>x[1]>>y[1];
line(x[0],y[0],x[1],y[1]);
for(int i=0;i<2;i++)
{
int bit1=0,bit2=0,bit3=0,bit4=0;
if(y[i]<ymin)
bit1=1;
if(y[i]>ymax)
bit2=1;
if(x[i]>xmax)
bit3=1;
if(x[i]<xmin)
bit4=1;
cout<<”For “<<i<<”th endpoint region code is :”<<bit1<<bit2<<bit3<<bit4;
num[i]=bit4*1+bit3*2+bit2*4+bit1*8;
}
if(!(num[0]|num[1]))
cout<<"Line is completely in window";
else if(!(num[0]&num[1]))
cout<<"Line is required to be clipped";
else
cout<<"Line is off the window";
getch();
}

Department of Computer Science & Engineering Page 32


Department of Computer Science & Engineering Page 33
Viva Questions:
Q1: What is a 4-bit region code, and how is it computed?
Q2: How do you determine whether a line is completely inside, completely outside, or partially inside a
viewport?
Q3: What happens if both endpoints have a region code of 0000?
Q4: How do you calculate the intersection points for clipping?
Q5: What happens if a line is parallel to a clipping boundary?

Department of Computer Science & Engineering Page 34


Experiment-8
Aim: a) Apply the Cohen-Sutherland Line Clipping algorithm to clip a line intersecting at one point with a
given window.
b) Apply the Cohen-Sutherland Line Clipping algorithm to clip a line intersecting at two or more points with
a given window
Objective: To clip a line intersecting at a single point and two or more points with a window using the
Cohen-Sutherland Line Clipping algorithm.
a) One point
Code:
#include"stdio.h"
#include"conio.h"
#include"graphics.h"
void main()
{
int gd=DETECT, gm;
float i,xmax,ymax,xmin,ymin,x1,y1,x2,y2,m;
float start[4],end[4],code[4];
clrscr();
initgraph(&gd,&gm,"");
printf("\n\tEnter the bottom-left coordinate of viewport: ");
scanf("%f %f",&xmin,&ymin);
printf("\n\tEnter the top-right coordinate of viewport: ");
scanf("%f %f",&xmax,&ymax);
printf("\nEnter the coordinates for starting point of line: ");
scanf("%f %f",&x1,&y1);
printf("\nEnter the coordinates for ending point of line: ");
scanf("%f %f",&x2,&y2);
for(i=0;i <4;i++)
{
start[i]=0;
end[i]=0;
}
m=(y2-y1)/(x2-x1);
if(x1 <xmin) start[0]=1;
if(x1 >xmax) start[1]=1;
if(y1 >ymax) start[2]=1;
if(y1 <ymin) start[3]=1;
if(x2 <xmin) end[0]=1;
if(x2 >xmax) end[1]=1;
if(y2 >ymax) end[2]=1;
if(y2 <ymin) end[3]=1;
for(i=0;i <4;i++)
code[i]=start[i]&&end[i];
if((code[0]==0)&&(code[1]==0)&&(code[2]==0)&&(code[3]==0))
{
if((start[0]==0)&&(start[1]==0)&&(start[2]==0)&&(start[3]==0)&&(end[0]==0)&&(end[1]==0)&&(end[2]
Department of Computer Science & Engineering Page 35
==0)&&(end[3]==0))
{
cleardevice();
printf("\n\t\tThe line is totally visible\n\t\tand not a clipping candidate");
rectangle(xmin,ymin,xmax,ymax);
line(x1,y1,x2,y2);
getch();
}
else
{
cleardevice();
printf("\n\t\tLine is partially visible");
rectangle(xmin,ymin,xmax,ymax);
line(x1,y1,x2,y2);
getch();
if((start[2]==0)&&(start[3]==1))
{
x1=x1+(ymin-y1)/m;
y1=ymin;
}
if((end[2]==0)&&(end[3]==1))
{
x2=x2+(ymin-y2)/m;
y2=ymin;
}
if((start[2]==1)&&(start[3]==0))
{
x1=x1+(ymax-y1)/m;
y1=ymax;
}
if((end[2]==1)&&(end[3]==0))
{
x2=x2+(ymax-y2)/m;
y2=ymax;
}
if((start[1]==0)&&(start[0]==1))
{
y1=y1+m*(xmin-x1);
x1=xmin;
}
if((end[1]==0)&&(end[0]==1))
{
y2=y2+m*(xmin-x2);
x2=xmin;
}
if((start[1]==1)&&(start[0]==0))
{
Department of Computer Science & Engineering Page 36
y1=y1+m*(xmax-x1);
x1=xmax;
}
if((end[1]==1)&&(end[0]==0))
{
y2=y2+m*(xmax-x2);
x2=xmax;
}
clrscr();
cleardevice();
printf("\n\t\tAfter clippling:");
rectangle(xmin,ymin,xmax,ymax);
line(x1,y1,x2,y2);
getch();
}
}
else
{
clrscr();
cleardevice();
printf("\nLine is invisible");
rectangle(xmin,ymin,xmax,ymax);
}
getch();
closegraph();
}

Output:

Department of Computer Science & Engineering Page 37


b) Two point
Code:
#include"stdio.h"
#include"conio.h"
#include"graphics.h"
void main()
{
int gd=DETECT, gm;
float i,xmax,ymax,xmin,ymin,x1,y1,x2,y2,m;
float start[4],end[4],code[4];
clrscr();
initgraph(&gd,&gm,"");
printf("\n\tEnter the bottom-left coordinate of viewport: ");
scanf("%f %f",&xmin,&ymin);
printf("\n\tEnter the top-right coordinate of viewport: ");
scanf("%f %f",&xmax,&ymax);
printf("\nEnter the coordinates for starting point of line: ");
scanf("%f %f",&x1,&y1);
printf("\nEnter the coordinates for ending point of line: ");
scanf("%f %f",&x2,&y2);
for(i=0;i <4;i++)
{
start[i]=0;
end[i]=0;
}
m=(y2-y1)/(x2-x1);
if(x1 <xmin) start[0]=1;
if(x1 >xmax) start[1]=1;
if(y1 >ymax) start[2]=1;
if(y1 <ymin) start[3]=1;
if(x2 <xmin) end[0]=1;
if(x2 >xmax) end[1]=1;
if(y2 >ymax) end[2]=1;
if(y2 <ymin) end[3]=1;
for(i=0;i <4;i++)
Department of Computer Science & Engineering Page 38
code[i]=start[i]&&end[i];
if((code[0]==0)&&(code[1]==0)&&(code[2]==0)&&(code[3]==0))
{
if((start[0]==0)&&(start[1]==0)&&(start[2]==0)&&(start[3]==0)&&(end[0]==0)&&(end[1]==0)&&(end[2]
==0)&&(end[3]==0))
{
cleardevice();
printf("\n\t\tThe line is totally visible\n\t\tand not a clipping candidate");
rectangle(xmin,ymin,xmax,ymax);
line(x1,y1,x2,y2);
getch();
}
else
{
cleardevice();
printf("\n\t\tLine is partially visible");
rectangle(xmin,ymin,xmax,ymax);
line(x1,y1,x2,y2);
getch();
if((start[2]==0)&&(start[3]==1))
{
x1=x1+(ymin-y1)/m;
y1=ymin;
}
if((end[2]==0)&&(end[3]==1))
{
x2=x2+(ymin-y2)/m;
y2=ymin;
}
if((start[2]==1)&&(start[3]==0))
{
x1=x1+(ymax-y1)/m;
y1=ymax;
}
if((end[2]==1)&&(end[3]==0))
{
x2=x2+(ymax-y2)/m;
y2=ymax;
}
if((start[1]==0)&&(start[0]==1))
{
y1=y1+m*(xmin-x1);
x1=xmin;
}
if((end[1]==0)&&(end[0]==1))
{
y2=y2+m*(xmin-x2);
Department of Computer Science & Engineering Page 39
x2=xmin;
}
if((start[1]==1)&&(start[0]==0))
{
y1=y1+m*(xmax-x1);
x1=xmax;
}
if((end[1]==1)&&(end[0]==0))
{
y2=y2+m*(xmax-x2);
x2=xmax;
}
clrscr();
cleardevice();
printf("\n\t\tAfter clippling:");
rectangle(xmin,ymin,xmax,ymax);
line(x1,y1,x2,y2);
getch();
}
}
else
{
clrscr();
cleardevice();
printf("\nLine is invisible");
rectangle(xmin,ymin,xmax,ymax);
}
getch();
closegraph();
}

Output:

Department of Computer Science & Engineering Page 40


Viva Questions:
Q1: List the steps involved in the Cohen-Sutherland algorithm?
Q2: How is the logical AND operation used in the algorithm?
Q3: How do you handle a case where a line is completely outside the viewport?
Q4: How do you compute the intersection points using the parametric equation of a line?
Q5: List the limitations of Cohen-Sutherland Line Clipping?

Department of Computer Science & Engineering Page 41


Experiment-9
Aim: Demonstrate the result of window-to-viewport transformation by implementing and visualizing the
process.

Code:
#include<iostream.h>
#include<graphics.h>
#include<conio.h>
#include<dos.h>
void main()
{
clrscr();
int gd=DETECT,gm;
initgraph(&gd,&gm,NULL);
float wxmin=10,wxmax=150,wymin=10,wymax=250;
float vxmin=200,vxmax=600,vymin=10,vymax=250;
int wx1=30,wy1=50,wx2=100,wy2=180;
rectangle(wxmin,wymin,wxmax,wymax);
rectangle(vxmin,vymin,vxmax,vymax);
float sx=(vxmax-vxmin)/(wxmax-wxmin);
float sy=(vymax-vymin)/(wymax-wymin);
line(wx1,wy1,wx2,wy2);
float vx1=sx*(wx1-wxmin)+vxmin;
float vy1=sy*(wy1-wymin)+vymin;
float vx2=sx*(wx2-wxmin)+vxmin;
float vy2=sy*(wy2-wymin)+vymin;
line(vx1,vy1,vx2,vy2);
outtextxy(60,260,"Window");
outtextxy(360,260,"Viewport");
getch();
}
Output:

Department of Computer Science & Engineering Page 42


Viva Questions:

Q1: List the purpose of window-to-viewport transformation?


Q2: Write the formula for transforming a point from window coordinates to viewport coordinates?
Q3: What happens if the aspect ratio of the window and viewport are different?
Q4: How do you implement panning and zooming using this transformation?
Q5: Differentiate between clipping and window-to-viewport transformation?

Aim: Lab Based Mini Project

Title of Hardware/Softwa Targeted


Domain Description Technology Objective
Project re Requirements Outcome
Develop a tool
to draw lines
using DDA, Understand Efficient and
Line Drawing Bresenham’s, PC, GCC/Visual and compare accurate line
Basic Graphics C/C++
Tool and Studio, graphics.h line drawing drawing
Symmetrical algorithms. techniques.
DDA
algorithms.
Create
interactive Develop User-defined
Interactive shapes PC, IDE with interactive shapes
Shape Creator C++/OpenGL
Drawing (triangles, graphics.h library graphics drawn
squares) with applications. interactively.
mouse input.
Design a A functional
graphical Practice digital clock
Digital Clock Animation digital clock PC, IDE C++/OpenGL animation and with
that updates in time updates. graphical
real-time. display.
Implement a
Understand
rotating 3D 3D object
3D
Rotating cube using rotation with
3D Graphics PC, IDE C++/OpenGL transformation
Cube perspective depth
s and
transformation perspective.
rotations.
s.
Visualize the
Cohen- Explore and Clear
Polygon Sutherland and implement visualization
Clipping Clipping Sutherland- PC, IDE C++/OpenGL polygon of polygon
Visualizer Hodgeman clipping clipping
algorithms for techniques. algorithms.
polygon

Department of Computer Science & Engineering Page 43


Title of Hardware/Softwa Targeted
Domain Description Technology Objective
Project re Requirements Outcome
clipping.
Transform and
Object
display a Understand
Window-to- rendering
graphical and implement
Viewport Transformatio based on
object from PC, IDE C++/OpenGL window-to-
Transformatio ns different
one window to viewport
n viewport
another mapping.
settings.
viewport.
Smooth
Design and curve
Study curve
Bezier Curve plot Bezier rendering
Curve Design PC, IDE C++/OpenGL generation and
Plotter curves using based on
interpolation.
control points. control
points.
Create a Interact with
A functional
viewer to 3D objects and
3D object
3D Object 3D manipulate 3D understand
PC, IDE C++/OpenGL viewer with
Viewer Visualization objects using object
user
keyboard/mou handling in 3D
interaction.
se inputs. space.
Implement Efficient
Depth Buffer Learn hidden rendering of
Hidden
(Z-Buffer) surface 3D scenes
Surface Rendering PC, IDE C++/OpenGL
algorithm for removal with hidden
Eliminator
hidden surface techniques. surfaces
removal. removed.
Animate a 3D
Explore
solar system Realistic
Solar System animation and
Animation with orbiting PC, IDE C++/OpenGL solar system
Model 3D modeling
planets and simulation.
concepts.
moons.
Develop a
Functional
program to Practice
maze
generate and interactive
Maze Interactive generation
visualize PC, IDE C++/OpenGL design and
Generator Design and
mazes using logical
visualization
line drawing algorithms.
tool.
algorithms.
Render a string A text
Combine text
in a graphical rendering
Graphics and and graphics
Text Renderer environment PC, IDE C++/OpenGL tool with
Text in a visual
with custom graphical
program.
fonts. elements.
Develop a 2D Learn Functional
Shooting Interactive
shooting game animation, 2D game
PC, IDE C++/OpenGL
Game Animation where targets event with target
move handling, and shooting
Department of Computer Science & Engineering Page 44
Title of Hardware/Softwa Targeted
Domain Description Technology Objective
Project re Requirements Outcome
randomly, and interactivity. mechanism.
the user aims
to hit them.
Visualize the
reflection of a Understand
Accurate
2D object and implement
Reflection Transformatio reflection
across lines PC, IDE C++/OpenGL reflection
Visualizer ns rendering for
like x=0, y=0, transformation
2D objects.
y=x, and s.
custom lines.
Simulate a Combine
graphical animation and Functional
Traffic Light Animation and
traffic light PC, IDE C++/OpenGL logic for real- traffic light
Simulation Modeling
system with world simulator.
timing logic. simulation.
Create a
Learn data Graphical
dynamic bar
Bar Chart Data representation bar chart
chart to PC, IDE C++/OpenGL
Visualizer Visualization through representatio
visualize data
graphics. n of data.
values.
Visualize how
circles of Study circle Graphical
Circle Pack different radii generation and representatio
Shape Filling PC, IDE C++/OpenGL
Visualizer pack into a spatial filling n of circle
rectangular algorithms. packing.
area.
Simulate a rain Understand
Realistic
Animation of animation with animation
Animation PC, IDE C++/OpenGL rain
Raindrops multiple principles
simulation.
moving drops. using graphics.
Develop a Efficient line
program to Learn intersection
Line
Geometry and find geometry and detection
Intersection PC, IDE C++/OpenGL
Algorithms intersections line and
Finder
between lines algorithms. visualization
in a given set. .
Render a
Learn grid- A functional
graphical
Chessboard based chessboard
2D Graphics chessboard PC, IDE C++/OpenGL
Renderer rendering and rendering
with movable
interactivity. tool.
pieces.
Simulate ocean
Explore wave Realistic
Ocean Wave waves using
Animation PC, IDE C++/OpenGL patterns and ocean wave
Simulation sinusoidal
animation. simulation.
equations.
Pac-Man Interactive Develop a PC, IDE C++/OpenGL Combine A functional
Department of Computer Science & Engineering Page 45
Title of Hardware/Softwa Targeted
Domain Description Technology Objective
Project re Requirements Outcome
Game Animation basic Pac-Man animation and Pac-Man
game with interactivity game
moving for gaming. simulation.
enemies and
collectables.
Render and
Learn basic
animate a 3D Realistic 3D
3D Pyramid 3D object
3D Graphics pyramid with PC, IDE C++/OpenGL pyramid
Renderer rendering with
lighting and rendering.
lighting.
shadows.
Simulate a Explore Realistic
Particle
Animation and particle particle particle
Explosion PC, IDE C++/OpenGL
Modeling explosion with systems and explosion
Simulation
fading effects. animation. simulation.
Generate a 2D
Learn
city skyline Dynamic
City Skyline Procedural procedural
based on PC, IDE C++/OpenGL city skyline
Generator Graphics graphics
random rendering.
generation.
parameters.
Implement
Understand Realistic
Phong and
shading object
3D Object Gouraud
Rendering PC, IDE C++/OpenGL models in shading
Shading shading
computer visualization
techniques on
graphics. .
3D objects.
Create a tool to Learn color
Interactive Functional
Interactive select and representation
Color Palette PC, IDE C++/OpenGL color palette
Design preview colors and
Picker tool.
in a palette. interactivity.
Simulate
Explore
fireworks with Realistic
Fireworks particle effects
Animation colorful PC, IDE C++/OpenGL fireworks
Simulation and animation
particle animation.
timing.
effects.
Simulate a
roller coaster Functional
3D Roller Combine 3D
Animation and ride with 3D roller
Coaster PC, IDE C++/OpenGL modeling and
Modeling dynamic coaster
Simulator animation.
curves and 3D simulation.
views.
Plot
mathematical
Learn graph Accurate
functions like
Data plotting and mathematica
Graph Plotter sine, cosine, PC, IDE C++/OpenGL
Visualization coordinate l graph
and
systems. rendering.
exponential
graphs.
Department of Computer Science & Engineering Page 46
Title of Hardware/Softwa Targeted
Domain Description Technology Objective
Project re Requirements Outcome
Develop a
A functional
basic 3D game
Understand the game engine
engine with
High-performance architecture capable of
functionalities
3D Game Game PC, C++/OpenGL/Direct and rendering
like object
Engine Development OpenGL/DirectX, X development and
rendering,
IDE of a game simulating
collision
engine. basic
detection, and
physics.
physics.
Create an
Immersive
interactive VR PC with VR Explore VR
Virtual VR
Virtual Reality maze where headset, development
Reality Maze C#/C++ experience
(VR) users can Unity/Unreal and interaction
Explorer for maze
navigate using Engine mechanisms.
navigation.
VR devices.
Realistic
Implement a Learn fluid
fluid
realistic fluid High-performance simulation
Advanced movement
dynamics PC, C++/OpenGL/Direct techniques
Fluid Simulation and
simulation for OpenGL/DirectX, X using Navier-
Simulation interaction
water and IDE Stokes
visualization
other liquids. equations.
.
Design a 3D
A 3D city
city model Understand
3D City model with
with dynamic city modeling
Model with Urban PC, Blender/Unity, interactive
traffic and C#/Unity and integrate
Traffic Modeling IDE and dynamic
pedestrian dynamic
Simulation traffic
movement simulations.
simulations.
simulation.
Create a facial Realistic
Explore the
animation facial
Facial principles of
system using PC, IDE, graphics animations
Animation Animation C++/OpenGL facial
key points and library based on
System morphing and
morphing input
animation.
techniques. keyframes.
Develop a
dynamic Learn
Real-time
terrain procedural
terrain
Dynamic rendering High-performance terrain
Terrain C++/OpenGL/Direct deformation
Terrain engine with PC, Unity/Unreal generation and
Visualization X and weather
Rendering real-time Engine dynamic
visualization
deformation effects
.
and weather integration.
effects.
Solar System Model a solar PC, IDE, physics Combine Interactive
with Simulation system with and graphics C++/OpenGL simulation solar system
Interactive gravity and libraries with simulation
Department of Computer Science & Engineering Page 47
Title of Hardware/Softwa Targeted
Domain Description Technology Objective
Project re Requirements Outcome
Physics orbital physics, interactivity with realistic
allowing user for learning physics.
interaction to orbital
modify mechanics.
parameters.
Build an AR
Explore AR
application to Functional
Augmented PC, AR-capable development
place and AR app for
Reality Augmented device, and integrate
manipulate 3D C++/Unity real-world
Object Reality (AR) ARToolkit/Vuforia real-world
objects in a object
Placement SDK object
real-world placement.
mapping.
environment.
Implement a
basic path Understand High-quality
tracing advanced rendering
High-performance
Path Tracing algorithm to rendering with realistic
Rendering PC, IDE, graphics C++/OpenGL
Renderer simulate techniques for light and
library
realistic photorealistic shadow
lighting and images. effects.
shadows.
Combine AI Autonomous
Create a 3D
algorithms vehicle
simulation of
with 3D simulation
Autonomous an autonomous High-performance
graphics to with
Vehicle Simulation vehicle PC, Unity/ROS, Python/C++/Unity
simulate collision
Simulator navigating a IDE
autonomous avoidance
dynamic
vehicle and
environment.
behavior. pathfinding.

Department of Computer Science & Engineering Page 48


Assessment Model

Sr. Time Spent


No. Name of Activity by Teacher approximately * Student Activity
1. Introduction of experiment, teaching the
background theory of the experiment and 20-25 minutes Learning
information about the reading material
available/Video.
2. Discussion about the Worksheet record to be 5 minutes Learning
submitted.
Demonstrating Actual Simulator/Design/ Live 20-25 minutes
3. demonstration of the experiment. Learning
Giving some random values of the variables to Performance by
4. students in individually or in groups (Student 45 minutes** the students and
Performance). calculations

5. Submission of Work Sheets by students and


evaluation with Rubrics. ---- ---
6. Viva Voce (based on the experiment covered) 45 minutes** Evaluation

*The segments mentioned above needs to be covered in each practical lab but the time allocated
to each segment can be changed as per the requirement of the practical delivery and orientation.
** Can be carried out simultaneously.

Sr. Assessment Criterion Weightage


No.
Student Performance (Conduct of experiment)
1. 12 marks

Viva Voce
2. 10 marks
Submission of Work Sheet (Record)
3. 8 marks
Total 30 marks

Department of Computer Science & Engineering Page 49


Assessment Pattern for Complete Practical Course: (60: Internal and 40: External)
Weightage of Final Weightage
Sr. actual Frequency of in Internal Remarks
No. Type of Assessment Task conduct task Assessment
(Prorated Marks)

Practical Worksheet and 30 marks for 8-12 45 marks Depending upon


1. Class-room Learning each experiments no. of experiments
experiment
1 per At-least after the
2. Mid-Term Test 15 marks semester 15 marks completion of 5
experiments.
Mid-Term Test (For 1 per At-least after the
3. Hybrid Subjects) 10 marks semester 10 marks completion of 5
experiments.

Department of Computer Science & Engineering Page 50


CONTINUOUS LAB ASSESSMENT FORMAT

Course Experiment No 1 to 10
S.no
UID StudentName Section Code
conduct viva worksheet
12 10 8 Total

Bifurcation of the 30 marks is as follows:


Conduct: 12 Marks
Viva Voce: 10 Marks
Worksheet: 8 Marks

Bifurcation for Practical’s July-Dec,2024.

Conduct: 12 Marks Viva Voce: 10 Marks Worksheet: 8 Marks


Rubrics Rubrics Rubrics

1. 8 marks for logic 1. 5 viva Question 2 1. Aim- 1 Mark


followed according to marks each 2. Objective- 1 Mark
the problem statement. 3. Input/Apparatus Used-
2. 4 marks for code 1 Mark
writing skills. 4. Procedure- 1 Mark
5. Code- 2 Mark
6. Output- 2 Mark

Department of Computer Science & Engineering Page 51


Bifurcation of the 40 marks is as follows:

External Practical Evaluation Rubrics Assessment Criteria


Performance/Conduct : 10 Written Worksheet : 15
Marks Viva Voce: 15 Marks Marks
8 marks for proper all
6 marks for logic followed
parameters included (Aim,
according to the problem
Objective, Input/Apparatus
statement. Minimum 5 viva Question 3
Used, Procedure, Code).
marks each.
4 marks for code writing
5 marks for Logic
skills.
2 marks for Output

Department of Computer Science & Engineering Page 52

You might also like