Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

CGR Project ("Design An Analog Clock")

Download as pdf or txt
Download as pdf or txt
You are on page 1of 15

A

MICRO-PROJECT REPORT
ON

“DESIGN AN ANALOG CLOCK”


Submitted in fulfillment of the requirement for the internal assessment for
the subject computer Graphics for,

DIPLOMA SECOND YEAR IN

COMPUTER ENGINEERING

Shreya R Sonawane Enrollment No.1916240013

Saba H Mulani Enrollment No.1916240027

Under the guidance of

PROF. JYOTSAN MADAM

Professor, Computer Department

DEPARTMENT OF COMPUTER ENGINEERING

SIDDHANT COLLEGE OF ENGINEERING - [SCOE]


SUDUMBARE, PUNE
ACADEMIC YEAR: 2020-21
SIDDHANT COLLEGE OF ENGINEERING - [SCOE]
SUDUMBARE, PUNE
ACADEMIC YEAR: 2020-21
(MAHARASHTRA STATE)

This is to certify that, this Project report entitled-

“DESIGN AN ANALOG CLOCK”


Submitted by

Shreya Rakhamaji Sonawane Enrollment No.1916240013

Saba Habib Mulani Enrollment No.1916240027

For partial fulfilment of the requirement for the internal assessment for the Subject of Computer
Graphics of DIPLOMA SECOND YEAR in COMPUTER ENGINEERING as laid down by
MSBTE, is a record of their own work carried out by them under my supervision and guidance during
year 2020-2021

Place: Pune

PROF. JYOTSAN MADAM PROF. SARITA MADAM

PROJECT GUIDE HOD


ACKNOWLEDGEMENT
With all respect and gratitude, I would like to thank all people who have helped
me directly or indirectly for the completion of this Project work.
I thank my seminar guide for helping me to understand the project topic
conceptually in every phase of project work.
I express my heartily gratitude towards Head of department of Computer
Engineering for guiding me to understand the work conceptually and also for providing
necessary information and required resources with his constant encouragement to
complete this project work.
Last but not the least, I thank to all the Teaching & Non teaching staff members
of Computer Engineering Department for providing necessary information and required
resources.
I am ending this acknowledgement with deep indebtedness to my friends who have
helped me.

Shreya Rakhamaji Sonawane Enrollment No.1916240013

Saba Habib Mulani Enrollment No.1916240027


ABSTRACT

The project is idea to display the clock with computer graphics.


this project just used the local time,fetching from the computer and display it on thescreen.this project i
mplements the wall clock with the round circular boardand three conic geometric which forms the diffe
rent(sec,min &hour)hands.Here we are going to use time function to diplay time.In this project we areg
oing to get output has the current time
INDEX

SR.NO TOPICS PAGE


NO.
1. Introduction 6

2. Requirements 7
3. Implementation 8
4. Conclusion 14
5. References 15
CHAPTER 1

INTRODUCTION

➢ OVERVIEW :

The aim of this project is to implement an application package of Computergraphics using Ope
nGL. Here we represent the concepts displaying Analog clock inOpenGL.

➢ ABOUT GRAPHICS OpenGL:

Activities as wideranging as filmmaking, publishing, banking and educationcontinue to underg


o revolutionary changes as these technologies alter the ways inwhich we conduct our daily acti
vities. The combination of computers, network andthe complex human visual system, through
computer graphics, has led to new ways of displaying information seeing virtual worlds and co
mmunicating with people andmachines.A class in computer graphics allows the instructor to b
uild all these topics in away that can be both informative and fun. Low level algorithms such a
s those thatdraw lines or fill polygons are used in OpenGL.The development of OpenGL resol
ved both of the difficulties that wasexperienced with other APIs and with the alternative of usi
ng home – brewed s/w .OpenGL today is supported in all platforms

A clock or watch is called "analog" when it has moving hands and hours markedfrom 1 to 12 t
o show you the time.Analog clocks usually indicate time using angles. The most commonclock
face uses a fixed numbered dial or dials and moving hand or hands. It usually has a circularsca
le of 12hours,which can also serve as a scale of 60minutes,and 60seconds if theclock has a sec
ond hand. Many other styles and designs have been used throughout theyears, including dials d
ivided into 6, 8, 10, and 24 hours.The only other widely used clock face today is the24 hour an
alog dial , because of the use of 24 hour time inmilitary organizations and timetables
CHAPTER 2

REQUIREMENT

➢ SOFTWARE REQUIREMENT:

The project requires access to the OpenGL graphics library functions . Someof these library fu
nctions are contained in unique to C++ library header files such as

1) GL/glut.h

2) math.h

3) windows.h

4) time.h

To write, compile and link the program , a suitable C integrated developmentenvironment is re


quired . Microsoft Visual Studio/Code Blocks may be suitable in this regard.

Software requirement are:

1.Window Operating System

2. Microsoft Visual Studio

3. Code Blocks

➢ HARDWARE REQUIREMENT:

The minimum/recommended hardware configuration required for developing theproposed soft


ware is given below:

1. PENTIUM-2 and above compatible systems.

2. 128 MB RAM.

3. Approximately 1 MB free space in the hard disk.

4. Hard disk access time must be less than 19 milliseconds


CHAPTER 3
IMPLEMENTATION

#include<iostream.h>
#include<conio.h>
#include<stdio.h>
#include<stdlib.h>
#include<graphics.h>
#include<math.h>
#include<dos.h>
/*void drawdecor();*/
void drawclock();
void drawclogic();
void usecolor();
void main()
{
clrscr();
int gdriver=DETECT ,gmode;
initgraph(&gdriver,&gmode,"c:\\tc\\bgi");
cleardevice();
/*Clock layout and logic called in usecolor method*/
usecolor();
getch();
closegraph();
}
/*Draw clock steps method */
void drawclock()
{
/*SIDE BORDER*/
rectangle(0,0,600,470);
rectangle(5,5,595,465);
/*CLOCK BOX*/
setcolor(25);
rectangle(145,65,500,415);
line(175,35,145,65);
line(530,35,500,65);
line(530,385,500,415);
line(175,35,530,35);
line(530,35,530,385);
line(275,60,295,40);
line(325,60,345,40);
line(275,60,325,60);
line(295,40,345,40);
/*CLOCK TITLE*/
setcolor(15);
rectangle(20,150,130,280);

/*gotoxy(5,5);
printf("demla \n,pramod \n, lavina\n");*/
setcolor(10);
outtextxy(27,195,"Designed By:");
outtextxy(27,215,"demlaip");
outtextxy(27,235,"pramod");
outtextxy(27,255,"lavina");
cout<<" ";
rectangle(25,155,125,180);
setcolor(YELLOW);
outtextxy(27,160,"Analog Clock");
/*CLOCK CIRCLES*/
setbkcolor(0);
setcolor(4); /*RED*/
circle(320,240,3);
setcolor(4);
/*setfillstyle(6,13);*/
circle(320,240,150);
circle(320,240,165);
/*CLOCK NUMBERS*/
setcolor(14);
outtextxy(314,98,"12");
outtextxy(384,114,"1");
outtextxy(434,163,"2");
outtextxy(454,230,"3");
outtextxy(317,369,"6");
outtextxy(177,230,"9");
outtextxy(436,300,"4");
outtextxy(195,302,"8");
outtextxy(195,163,"10");
outtextxy(244,112,"11");
outtextxy(388,353,"5");
outtextxy(248,353,"7");
}
/*CALCULATION Logic of draw clock*/
void drawclogic()
{
float s;
float df;
float anf=3.14;
int x,y;
int q,w;
int ta,d;

int count=0;
struct time t1;
gettime(&t1);
float angle=4.712389+t1.ti_sec*.1047198;
float an=4.712389+t1.ti_min*.1047198;

while(!kbhit())
{
setcolor(count);
rectangle(20,20,130,90);
gettime(&t1);
gotoxy(5,5);
printf("%d: %d: %d",
cout<<" ";
rectangle(25,25,125,45);
setcolor(YELLOW);
outtextxy(27,30,"Digital Time");
gotoxy(5,5);
angle=4.712389+t1.ti_sec*.1047198;
an=4.712389+t1.ti_min*.1047198;
anf=4.712389+t1.ti_hour*5*.1047198 ;
if(t1.ti_min>=12&&t1.ti_min<24)
{
anf=anf+2*.1047198;
}
if(t1.ti_min>=24&&t1.ti_min<36)
{
anf=anf+(3*.1047198);
}
if(t1.ti_min>=36&&t1.ti_min<48)
{
anf=anf+(4*.1047198);
}
if(t1.ti_min>=48&&t1.ti_min<60)
{
anf=anf+(5*.1047198);
}
setlinestyle(0,0,0);
setcolor(0);
line(320,240,x,y);
line(320,240,q,w);
line(320,240,ta,d);
x=320+140*cos(angle);
y=240+140*sin(angle);
q=320+120*cos(an);
w=240+120*sin(an);
ta=320+80*cos(anf);
d=240+80*sin(anf);
setcolor(10);
line(320,240,x,y);
setcolor(9);
line(320,240,q,w);
setcolor(4);
line(320,240,ta,d);

angle+=.1047198;
delay(1000);
count++;
}
}
void usecolor()
{
setbkcolor(0);
int usecolor,ch;
do
{
outtextxy(25,240,"Clock Circumference");
outtextxy(25,260," Colour Menu");
outtextxy(25,280,"1: RED");
outtextxy(25,300,"2:BLUE");
outtextxy(25,320,"3:User defined");
cin>>ch;
switch(ch)
{
case 1:setcolor(4); /*RED*/
circle(320,240,3);
setcolor(4);
/*setfillstyle(6,13);*/
circle(320,240,150);
circle(320,240,165);
drawclock();
drawclogic();
break;
case 2:setcolor(7); /*RED*/
circle(320,240,3);
setcolor(7);
/*setfillstyle(6,13);*/
circle(320,240,150);
circle(320,240,165);
drawclock();
drawclogic();
break;
case 3:cout<<"value of color\n"<<endl;
cin>>usecolor;
setcolor(usecolor); /*RED*/
circle(320,240,3);

setcolor(usecolor);
/*setfillstyle(6,13);*/
circle(320,240,150);
circle(320,240,165);
drawclock();
drawclogic();

}
}while(ch!=3);
}
OUTPUT:-

First Output Screen

Final Output Screen


CHAPTER 4

CONCLUSION

This project shows the graphical representation of a working analogue clock.The


objective of this program is to implement simple and basic functions of OpenGL.
Computer graphics plays a major role in today’s world where visualization takes
theupper hand as compared to textual interaction. This is largely true as we can s
ee userinterface becoming more and more attractive all thanks to major leaps in t
he fields of computer graphics. The project is implemented using graphics Open
GL packageprovided by C.The above argument is equally justified in the fields o
f computer simulationwhich involve complex graphics being highlighted at its pe
ak. It is becoming moreand more popular and the constant dive to improve partic
ular system efficiency bystudying its simulated model attracts more
people towards it
CHAPTER 5
REFERENCES

1. Interactive Computer Graphics – A Top-Down Approach Using OpenGL.

2. Computer Graphics Using OpenGL – F.S Hill, Jr.,2nd Edition, Pearson


Education ,2001

3. Computer Graphics –
James D Foley , Andries Van Dam , Steven K Feiner ,John F Hughes , Addison –
Wesley 1997

4. Computer Graphics – OpenGL Version – Donald Hearn and Pauline Baker ,2nd
Edition , Pearson Education

You might also like