A Man in The Rain Animation: in Computer Science and Engineering
A Man in The Rain Animation: in Computer Science and Engineering
A Man in The Rain Animation: in Computer Science and Engineering
on
Submitted By
SAI SANTOSH MALLADI
179303126
VI-CSE
BACHELOR OF TECHNOLOGY
In Computer Science and Engineering
2017-2021
The term computer graphics has been used in a broad sense to describe "almost everything on
computers that is not text or sound". Typically, the term computer graphics refers to several
different things:
The representation and manipulation of image data by a computer
The various technologies used to create and manipulate images
Methods for digitally synthesizing and manipulating visual content, see study of
computer graphics
Computer graphics is branch of computer science that deals with generating images with the aid
of computers. Today, computer graphics is a core technology in digital photography, film, video
games, cell phone and computer displays, and many specialized applications. A great deal of
specialized hardware and software has been developed, with the displays of most devices being
driven by computer graphics hardware. It is a vast and recently developed area of computer
science. The phrase was coined in 1960 by computer graphics researchers Verne Hudson and
William Fetter of Boeing. It is often abbreviated as CG, or typically in the context of film
as CGI.
Computer graphics is responsible for displaying art and image data effectively and meaningfully
to the consumer. It is also used for processing image data received from the physical world.
Computer graphics development has had a significant impact on many types of media and has
revolutionized animation, movies, advertising, video games, and graphic design in general.
METHEDOLOGY
In computer graphics, we use graphics.h which provide facility of direct functions to draw
different 2D geometric shapes such as point, line, triangle, quadrilaterals, circle, ellipse and
many more such shapes. By help of these functions we can draw different objects like car, hut,
trees etc.
2. Circle():
The header file graphics.h contains circle() function which draws a circle with center at (x, y)
and given radius.
3. Line():
A function from graphics.h header file which draw a line with (x1, y1) as first coordinate of line
and (x2, y2) as second coordinate of the line.
4. Piesclice(): pieslice() draws and fills a pie slice with center at (x, y) and given radius r. The
slice travels from s_angle to e_angle which are starting and ending angles for the pie slice.
The angles for pie-slice are given in degrees and are measured counterclockwise.
User defined functions in the program :
1. void displayMan() : This function is used to create and display the man on screen .
various shapes from the graphics.h library are used to create this.
2. void drawCloud() : This function is used to draw and create the cloud on the screen.
Tools :
1. Turbo C++ to compile and run the code with graphics.h library
Implementation
#include<conio.h>
#include<stdio.h>
#include<graphics.h>
void displayMan(int x,int y)
{
circle(x,y,10); //face
line(x,y+10,x,y+30); //neck
line(x,y+30,x-20,y+40); //left hand
line(x,y+30,x+20,y+40); //right hand
line(x+20,y+40,x+30,y+30);
line(x,y+30,x,y+70); //body
line(x+30,y+30,x+30,y-90); //umbrella
pieslice(x+30,y-30,0,180,55);
}
void drawCloud(int z,int y)
{
int r=50;
arc(z,y,45,135,r);
arc(z+50,y,45,135,r);
arc(z+100,y,45,135,r);
arc(z,y,135,225,r);
arc(z+50,y,135+90,225+90,r);
arc(z,y,135+90,225+90,r);
arc(z+100,y,135+90,225+90,r);
arc(z+100,y,315,45,r);
}
void main()
{
int gd=DETECT, gm,i,d=0,x=50,y=340,z=50,shouldMove=1;
int rx,ry;
initgraph(&gd,&gm,"C:\\TURBOC3\\BGI");
while(!kbhit())
{
cleardevice();
displayMan(x,340);
drawCloud(z,60);
line(0,430,639,430);
for(i=0;i<500;i++)
{
rx=rand()%639;
ry=rand()%439;
if(rx>=(x-40)&&rx<=(x+110))
if(ry>=(y-50)&&ry<=479)
continue;
line(rx-10,ry+10,rx,ry);
}
//legs
if(shouldMove)
{
if(d<20)
d+=4;
else
shouldMove=0;
line(x,y+70,x-d,y+90);
line(x,y+70,x+d,y+90);
}
else
{
if(d>0)
d-=4;
else
shouldMove=1;
line(x,y+70,x-d,y+90);
line(x,y+70,x+d,y+90);
}
delay(200);
x=(x+10)%639;
}
getch();
}
Output :
Future Work and Conclusion
Future Work:
1. Option to change the direction of wind speed and rain.
2. Option to change objects to view in rain.
Conclusion :
This project was to understand the basic functionalities of graphics.h library and it’s commonly
used functions and tries to apply the concepts of the course Computer Graphics and Multimedia.
This project was also to understand the basics of graphics which would be beneficial for much
further advanced application and using of different software for designing and animation
References:
1. https://developerinsider.co/graphics-graphics-h-c-programming/