SlideShare a Scribd company logo
COMPUTER GRAPHICS -
DANCING DOLL
BASICS:
Computer graphics is an art of drawing pictures on computer screens with the help
of programming and algorithms. It involves computations, creation, and
manipulation of data. In other words, we can say that computer graphics is a
rendering tool for the generation and manipulation of images.
Application of Computer Graphics
1.Computer graphics user interfaces (GUIs). 2.Business presentation graphics
3.Cartography Weather Maps 4.Satellite Imaging Photo Enhancement
5.Medical Imaging 6.Engineering drawings
7.Typography 8.Architecture Art
9.Entertainment 10.Simulation and modeling
GRAPHICS.H
Used to draw different shapes, display text in different fonts, change colors and many more. Using functions of
graphics.h in Turbo C compiler you can make graphics programs, animations, projects, and games. You can draw
circles, lines, rectangles, bars and many other geometrical figures. You can change their colors using the available
functions and fill them. Following is a list of functions of graphics.h header file. Every function is discussed with the
arguments it needs, its description
GRAPHICS.H FUNCTIONS
arc bar bar3d circle
cleardevice closegraph drawpoly ellipse
fillellipse fillpoly floodfill getarccords
getbkcolor getcolor getdrivername getimage
getmaxcolor getmaxx getmaxy getpixel
getx gety graphdefaults grapherrormsg
imagesize line lineto linerel
moveto moverel outtext outtextxy
pieslice putimage putpixel rectangle
sector setbkcolor setcolor setfillstyle
setlinestyle settextstyle setviewport textheight textwidth
BASICS: LINE GENERATION ALGORITHM
In any 2-Dimensional plane if we connect two points (x0, y0) and (x1, y1), we get a line segment. But in the
case of computer graphics we can not directly join any two coordinate points, for that we should
CALCULATE INTERMEDIATE POINT’S COORDINATE and put a pixel for each intermediate point, of
the desired color with help of functions like putpixel(x, y, K) in C, where (x,y) is our co-ordinate and K
denotes some color
 DDAALGORITHM
 BRESENHAM’S LINE GENERATION
 MID-POINT ALGORITHM
DDA- LINE GENERATION ALGORITHM
Consider one point of the line as (X0,Y0) and the second point of the line as (X1,Y1).
// calculate dx , dy
dx = X1 - X0;
dy = Y1 - Y0;
// Depending upon absolute value of dx & dy
// choose number of steps to put pixel as
// steps = abs(dx) > abs(dy) ? abs(dx) : abs(dy)
steps = abs(dx) > abs(dy) ? abs(dx) : abs(dy);
// calculate increment in x & y for each steps
Xinc = dx / (float) steps;
Yinc = dy / (float) steps;
// Put pixel for each step
X = X0;
Y = Y0;
for (int i = 0; i <= steps; i++)
{
putpixel (X,Y,WHITE);
X += Xinc;
Y += Yinc;
}
BASICS: CIRCLE GENERATION ALGORITHM
 Drawing a circle on the screen is a little complex than drawing a line. There are two popular
algorithms for generating a circle: Bresenham’s Algorithm and Midpoint Circle Algorithm.
These algorithms are based on the idea of determining the subsequent points required to draw
the circle. Bresenham’s Algorithm:
Step 1 − Get the coordinates of the center of the circle and radius, and store them in
x, y, and R respectively. Set P=0 and Q=R.
Step 2 − Set decision parameter D = 3 – 2R.
Step 3 − Repeat through step-8 while P ≤ Q.
Step 4 − Call Draw Circle X,Y,P,QX,Y,P,Q.
Step 5 − Increment the value of P.
Step 6 − If D < 0 then D = D + 4P + 6.
Step 7 − Else Set R = R - 1, D = D + 4P−QP−Q + 10.
Step 8 − Call Draw Circle X,Y,P,Q.
putpixel (X + P, Y + Q)
putpixel (X - P, Y + Q)
putpixel (X + P, Y - Q)
putpixel (X - P, Y - Q)
putpixel (X + Q, Y + P)
putpixel (X - Q, Y + P)
putpixel (X + Q, Y - P)
putpixel (X - Q, Y - P)
BASICS: POLYGON FILLING
Polygon is an ordered list of vertices as shown in the following figure. For filling polygons with
particular colors, you need to determine the pixels falling on the border of the polygon and
those which fall inside the polygon.
Scan Line Algorithm
Flood Fill Algorithm
Boundary Fill Algorithm
4-Connected Polygon
8-Connected Polygon
Inside-outside Test : 1. Odd-Even Rule 2.Nonzero winding number rule
COMPUTER ANIMATION
The basic idea behind animation is to play back the recorded images at the rates fast enough to
fool the human eye into interpreting them as continuous motion. Animation can make a series of
dead images come alive. Animation can be used in many areas like entertainment, computer
aided-design, scientific visualization, training, education, e-commerce, and computer art.
Traditional Animation (frame by frame) : Key Framing
 A keyframe is a frame where we define changes in animation. Every frame is a keyframe when we
create frame by frame animation. When someone creates a 3D animation on a computer, they usually
don’t specify the exact position of any given object on every single frame. They create keyframes.
 Keyframes are important frames during which an object changes its size, direction, shape or other
properties. The computer then figures out all the in-between frames and saves an extreme amount of
time for the animator. The following illustrations depict the frames drawn by user and the frames
generated by computer.
DANCING DOLL: Visualization
Initial position
DANCING DOLL: CODE & OUTPUT
DANCING DOLL: DANCING DOLL

More Related Content

What's hot

Managing input and output operations in c
Managing input and output operations in cManaging input and output operations in c
Managing input and output operations in c
niyamathShariff
 
Android Layout.pptx
Android Layout.pptxAndroid Layout.pptx
Android Layout.pptx
vishal choudhary
 
Computer graphics practical(jainam)
Computer graphics practical(jainam)Computer graphics practical(jainam)
Computer graphics practical(jainam)
JAINAM KAPADIYA
 
1. python for data science
1. python for data science1. python for data science
1. python for data science
Dr Nisha Arora
 
Python and its Applications
Python and its ApplicationsPython and its Applications
Python and its Applications
Abhijeet Singh
 
Introduction to 2D/3D Graphics
Introduction to 2D/3D GraphicsIntroduction to 2D/3D Graphics
Introduction to 2D/3D Graphics
Prabindh Sundareson
 
Computer graphics lab manual
Computer graphics lab manualComputer graphics lab manual
Computer graphics lab manual
Uma mohan
 
COMPUTER GRAPHICS PROJECT REPORT
COMPUTER GRAPHICS PROJECT REPORTCOMPUTER GRAPHICS PROJECT REPORT
COMPUTER GRAPHICS PROJECT REPORT
vineet raj
 
04. Console Input Output
04. Console Input Output 04. Console Input Output
04. Console Input Output
Intro C# Book
 
Stress detection using Image processing
Stress detection using Image processingStress detection using Image processing
Stress detection using Image processing
College of Engineering pune
 
fundamentals of c
fundamentals of cfundamentals of c
fundamentals of c
Vijayalaxmi Wakode
 
Data Visualization using different python libraries.pptx
Data Visualization using different python libraries.pptxData Visualization using different python libraries.pptx
Data Visualization using different python libraries.pptx
HamzaAli998966
 
License Plate Recognition System using Python and OpenCV
License Plate Recognition System using Python and OpenCVLicense Plate Recognition System using Python and OpenCV
License Plate Recognition System using Python and OpenCV
Vishal Polley
 
Benefits & features of python |Advantages & disadvantages of python
Benefits & features of python |Advantages & disadvantages of pythonBenefits & features of python |Advantages & disadvantages of python
Benefits & features of python |Advantages & disadvantages of python
paradisetechsoftsolutions
 
Android fundamentals and tutorial for beginners
Android fundamentals and tutorial for beginnersAndroid fundamentals and tutorial for beginners
Android fundamentals and tutorial for beginners
Boom Shukla
 
The Ultimate Java Mastery Series - Code With Mosh
The Ultimate Java Mastery Series - Code With MoshThe Ultimate Java Mastery Series - Code With Mosh
The Ultimate Java Mastery Series - Code With Mosh
Coding Made Simple
 
Online vehicle renting website
Online vehicle renting websiteOnline vehicle renting website
Online vehicle renting website
Somendra Singh
 
Introduction to Python Programming language.pptx
Introduction to Python Programming language.pptxIntroduction to Python Programming language.pptx
Introduction to Python Programming language.pptx
BharathYusha1
 
Graphics Programming in C
Graphics Programming in CGraphics Programming in C
Graphics Programming in C
Kasun Ranga Wijeweera
 
C++ Notes by Hisham Ahmed Rizvi for Class 12th Board Exams
C++ Notes by Hisham Ahmed Rizvi for Class 12th Board ExamsC++ Notes by Hisham Ahmed Rizvi for Class 12th Board Exams
C++ Notes by Hisham Ahmed Rizvi for Class 12th Board Exams
hishamrizvi
 

What's hot (20)

Managing input and output operations in c
Managing input and output operations in cManaging input and output operations in c
Managing input and output operations in c
 
Android Layout.pptx
Android Layout.pptxAndroid Layout.pptx
Android Layout.pptx
 
Computer graphics practical(jainam)
Computer graphics practical(jainam)Computer graphics practical(jainam)
Computer graphics practical(jainam)
 
1. python for data science
1. python for data science1. python for data science
1. python for data science
 
Python and its Applications
Python and its ApplicationsPython and its Applications
Python and its Applications
 
Introduction to 2D/3D Graphics
Introduction to 2D/3D GraphicsIntroduction to 2D/3D Graphics
Introduction to 2D/3D Graphics
 
Computer graphics lab manual
Computer graphics lab manualComputer graphics lab manual
Computer graphics lab manual
 
COMPUTER GRAPHICS PROJECT REPORT
COMPUTER GRAPHICS PROJECT REPORTCOMPUTER GRAPHICS PROJECT REPORT
COMPUTER GRAPHICS PROJECT REPORT
 
04. Console Input Output
04. Console Input Output 04. Console Input Output
04. Console Input Output
 
Stress detection using Image processing
Stress detection using Image processingStress detection using Image processing
Stress detection using Image processing
 
fundamentals of c
fundamentals of cfundamentals of c
fundamentals of c
 
Data Visualization using different python libraries.pptx
Data Visualization using different python libraries.pptxData Visualization using different python libraries.pptx
Data Visualization using different python libraries.pptx
 
License Plate Recognition System using Python and OpenCV
License Plate Recognition System using Python and OpenCVLicense Plate Recognition System using Python and OpenCV
License Plate Recognition System using Python and OpenCV
 
Benefits & features of python |Advantages & disadvantages of python
Benefits & features of python |Advantages & disadvantages of pythonBenefits & features of python |Advantages & disadvantages of python
Benefits & features of python |Advantages & disadvantages of python
 
Android fundamentals and tutorial for beginners
Android fundamentals and tutorial for beginnersAndroid fundamentals and tutorial for beginners
Android fundamentals and tutorial for beginners
 
The Ultimate Java Mastery Series - Code With Mosh
The Ultimate Java Mastery Series - Code With MoshThe Ultimate Java Mastery Series - Code With Mosh
The Ultimate Java Mastery Series - Code With Mosh
 
Online vehicle renting website
Online vehicle renting websiteOnline vehicle renting website
Online vehicle renting website
 
Introduction to Python Programming language.pptx
Introduction to Python Programming language.pptxIntroduction to Python Programming language.pptx
Introduction to Python Programming language.pptx
 
Graphics Programming in C
Graphics Programming in CGraphics Programming in C
Graphics Programming in C
 
C++ Notes by Hisham Ahmed Rizvi for Class 12th Board Exams
C++ Notes by Hisham Ahmed Rizvi for Class 12th Board ExamsC++ Notes by Hisham Ahmed Rizvi for Class 12th Board Exams
C++ Notes by Hisham Ahmed Rizvi for Class 12th Board Exams
 

Similar to computer graphics-C/C++-dancingdollcode

Cgm Lab Manual
Cgm Lab ManualCgm Lab Manual
Computer graphics lab manual
Computer graphics lab manualComputer graphics lab manual
Computer graphics lab manual
Ankit Kumar
 
Computer graphics
Computer graphicsComputer graphics
Computer graphics
Diksha Trivedi
 
raster algorithm.pdf
raster algorithm.pdfraster algorithm.pdf
raster algorithm.pdf
Mattupallipardhu
 
Cgm Lab Manual
Cgm Lab ManualCgm Lab Manual
Computer graphics notes watermark
Computer graphics notes watermarkComputer graphics notes watermark
Computer graphics notes watermark
RAJKIYA ENGINEERING COLLEGE, BANDA
 
Computer graphics notes
Computer graphics notesComputer graphics notes
Computer graphics notes
RAJKIYA ENGINEERING COLLEGE, BANDA
 
CD504 CGM_Lab Manual_004e08d3838702ed11fc6d03cc82f7be.pdf
CD504 CGM_Lab Manual_004e08d3838702ed11fc6d03cc82f7be.pdfCD504 CGM_Lab Manual_004e08d3838702ed11fc6d03cc82f7be.pdf
CD504 CGM_Lab Manual_004e08d3838702ed11fc6d03cc82f7be.pdf
RajJain516913
 
Computer graphics
Computer graphicsComputer graphics
Computer graphics
amitsarda3
 
Unit 2
Unit 2Unit 2
Unit 2
ypnrao
 
4 CG_U1_M3_PPT_4 DDA.pptx
4 CG_U1_M3_PPT_4 DDA.pptx4 CG_U1_M3_PPT_4 DDA.pptx
4 CG_U1_M3_PPT_4 DDA.pptx
ssuser255bf1
 
Primitives
PrimitivesPrimitives
Computer Graphics Notes 2.pdf
Computer Graphics Notes 2.pdfComputer Graphics Notes 2.pdf
Computer Graphics Notes 2.pdf
AOUNHAIDER7
 
mini prjt
mini prjtmini prjt
Computer graphics
Computer graphics Computer graphics
Computer graphics
shafiq sangi
 
Computer Graphics Unit 1
Computer Graphics Unit 1Computer Graphics Unit 1
Computer Graphics Unit 1
aravindangc
 
Computer graphics presentation
Computer graphics presentationComputer graphics presentation
Computer graphics presentation
LOKENDRA PRAJAPATI
 
Unit-1 basics of computer graphics
Unit-1 basics of computer graphicsUnit-1 basics of computer graphics
Unit-1 basics of computer graphics
Amol Gaikwad
 
Lab lecture 1 line_algo
Lab lecture 1 line_algoLab lecture 1 line_algo
Lab lecture 1 line_algo
simpleok
 
paper
paperpaper

Similar to computer graphics-C/C++-dancingdollcode (20)

Cgm Lab Manual
Cgm Lab ManualCgm Lab Manual
Cgm Lab Manual
 
Computer graphics lab manual
Computer graphics lab manualComputer graphics lab manual
Computer graphics lab manual
 
Computer graphics
Computer graphicsComputer graphics
Computer graphics
 
raster algorithm.pdf
raster algorithm.pdfraster algorithm.pdf
raster algorithm.pdf
 
Cgm Lab Manual
Cgm Lab ManualCgm Lab Manual
Cgm Lab Manual
 
Computer graphics notes watermark
Computer graphics notes watermarkComputer graphics notes watermark
Computer graphics notes watermark
 
Computer graphics notes
Computer graphics notesComputer graphics notes
Computer graphics notes
 
CD504 CGM_Lab Manual_004e08d3838702ed11fc6d03cc82f7be.pdf
CD504 CGM_Lab Manual_004e08d3838702ed11fc6d03cc82f7be.pdfCD504 CGM_Lab Manual_004e08d3838702ed11fc6d03cc82f7be.pdf
CD504 CGM_Lab Manual_004e08d3838702ed11fc6d03cc82f7be.pdf
 
Computer graphics
Computer graphicsComputer graphics
Computer graphics
 
Unit 2
Unit 2Unit 2
Unit 2
 
4 CG_U1_M3_PPT_4 DDA.pptx
4 CG_U1_M3_PPT_4 DDA.pptx4 CG_U1_M3_PPT_4 DDA.pptx
4 CG_U1_M3_PPT_4 DDA.pptx
 
Primitives
PrimitivesPrimitives
Primitives
 
Computer Graphics Notes 2.pdf
Computer Graphics Notes 2.pdfComputer Graphics Notes 2.pdf
Computer Graphics Notes 2.pdf
 
mini prjt
mini prjtmini prjt
mini prjt
 
Computer graphics
Computer graphics Computer graphics
Computer graphics
 
Computer Graphics Unit 1
Computer Graphics Unit 1Computer Graphics Unit 1
Computer Graphics Unit 1
 
Computer graphics presentation
Computer graphics presentationComputer graphics presentation
Computer graphics presentation
 
Unit-1 basics of computer graphics
Unit-1 basics of computer graphicsUnit-1 basics of computer graphics
Unit-1 basics of computer graphics
 
Lab lecture 1 line_algo
Lab lecture 1 line_algoLab lecture 1 line_algo
Lab lecture 1 line_algo
 
paper
paperpaper
paper
 

More from Bhavya Chawla

Version Control System - for Agile Software Project Management.
Version Control System - for Agile Software Project Management.Version Control System - for Agile Software Project Management.
Version Control System - for Agile Software Project Management.
Bhavya Chawla
 
Natural Language Processing
Natural Language ProcessingNatural Language Processing
Natural Language Processing
Bhavya Chawla
 
Ethical Hacking - sniffing
Ethical Hacking - sniffingEthical Hacking - sniffing
Ethical Hacking - sniffing
Bhavya Chawla
 
Employee Management System
Employee Management SystemEmployee Management System
Employee Management System
Bhavya Chawla
 
Sql introduction
Sql introductionSql introduction
Sql introduction
Bhavya Chawla
 
evolution of computers
 evolution of computers evolution of computers
evolution of computers
Bhavya Chawla
 
the generation of computers
the generation of computersthe generation of computers
the generation of computers
Bhavya Chawla
 

More from Bhavya Chawla (7)

Version Control System - for Agile Software Project Management.
Version Control System - for Agile Software Project Management.Version Control System - for Agile Software Project Management.
Version Control System - for Agile Software Project Management.
 
Natural Language Processing
Natural Language ProcessingNatural Language Processing
Natural Language Processing
 
Ethical Hacking - sniffing
Ethical Hacking - sniffingEthical Hacking - sniffing
Ethical Hacking - sniffing
 
Employee Management System
Employee Management SystemEmployee Management System
Employee Management System
 
Sql introduction
Sql introductionSql introduction
Sql introduction
 
evolution of computers
 evolution of computers evolution of computers
evolution of computers
 
the generation of computers
the generation of computersthe generation of computers
the generation of computers
 

Recently uploaded

SCALING OF MOS CIRCUITS m .pptx
SCALING OF MOS CIRCUITS m                 .pptxSCALING OF MOS CIRCUITS m                 .pptx
SCALING OF MOS CIRCUITS m .pptx
harshapolam10
 
ITSM Integration with MuleSoft.pptx
ITSM  Integration with MuleSoft.pptxITSM  Integration with MuleSoft.pptx
ITSM Integration with MuleSoft.pptx
VANDANAMOHANGOUDA
 
TIME TABLE MANAGEMENT SYSTEM testing.pptx
TIME TABLE MANAGEMENT SYSTEM testing.pptxTIME TABLE MANAGEMENT SYSTEM testing.pptx
TIME TABLE MANAGEMENT SYSTEM testing.pptx
CVCSOfficial
 
Introduction to verilog basic modeling .ppt
Introduction to verilog basic modeling   .pptIntroduction to verilog basic modeling   .ppt
Introduction to verilog basic modeling .ppt
AmitKumar730022
 
一比一原版(USF毕业证)旧金山大学毕业证如何办理
一比一原版(USF毕业证)旧金山大学毕业证如何办理一比一原版(USF毕业证)旧金山大学毕业证如何办理
一比一原版(USF毕业证)旧金山大学毕业证如何办理
uqyfuc
 
Design and optimization of ion propulsion drone
Design and optimization of ion propulsion droneDesign and optimization of ion propulsion drone
Design and optimization of ion propulsion drone
bjmsejournal
 
Bayesian Decision Theory details ML.pptx
Bayesian Decision Theory details ML.pptxBayesian Decision Theory details ML.pptx
Bayesian Decision Theory details ML.pptx
amrita chaturvedi
 
LLM Fine Tuning with QLoRA Cassandra Lunch 4, presented by Anant
LLM Fine Tuning with QLoRA Cassandra Lunch 4, presented by AnantLLM Fine Tuning with QLoRA Cassandra Lunch 4, presented by Anant
LLM Fine Tuning with QLoRA Cassandra Lunch 4, presented by Anant
Anant Corporation
 
Use PyCharm for remote debugging of WSL on a Windo cf5c162d672e4e58b4dde5d797...
Use PyCharm for remote debugging of WSL on a Windo cf5c162d672e4e58b4dde5d797...Use PyCharm for remote debugging of WSL on a Windo cf5c162d672e4e58b4dde5d797...
Use PyCharm for remote debugging of WSL on a Windo cf5c162d672e4e58b4dde5d797...
shadow0702a
 
smart pill dispenser is designed to improve medication adherence and safety f...
smart pill dispenser is designed to improve medication adherence and safety f...smart pill dispenser is designed to improve medication adherence and safety f...
smart pill dispenser is designed to improve medication adherence and safety f...
um7474492
 
Pressure Relief valve used in flow line to release the over pressure at our d...
Pressure Relief valve used in flow line to release the over pressure at our d...Pressure Relief valve used in flow line to release the over pressure at our d...
Pressure Relief valve used in flow line to release the over pressure at our d...
cannyengineerings
 
IEEE Aerospace and Electronic Systems Society as a Graduate Student Member
IEEE Aerospace and Electronic Systems Society as a Graduate Student MemberIEEE Aerospace and Electronic Systems Society as a Graduate Student Member
IEEE Aerospace and Electronic Systems Society as a Graduate Student Member
VICTOR MAESTRE RAMIREZ
 
Digital Twins Computer Networking Paper Presentation.pptx
Digital Twins Computer Networking Paper Presentation.pptxDigital Twins Computer Networking Paper Presentation.pptx
Digital Twins Computer Networking Paper Presentation.pptx
aryanpankaj78
 
5G Radio Network Througput Problem Analysis HCIA.pdf
5G Radio Network Througput Problem Analysis HCIA.pdf5G Radio Network Througput Problem Analysis HCIA.pdf
5G Radio Network Througput Problem Analysis HCIA.pdf
AlvianRamadhani5
 
Mechatronics material . Mechanical engineering
Mechatronics material . Mechanical engineeringMechatronics material . Mechanical engineering
Mechatronics material . Mechanical engineering
sachin chaurasia
 
Applications of artificial Intelligence in Mechanical Engineering.pdf
Applications of artificial Intelligence in Mechanical Engineering.pdfApplications of artificial Intelligence in Mechanical Engineering.pdf
Applications of artificial Intelligence in Mechanical Engineering.pdf
Atif Razi
 
Introduction to Computer Networks & OSI MODEL.ppt
Introduction to Computer Networks & OSI MODEL.pptIntroduction to Computer Networks & OSI MODEL.ppt
Introduction to Computer Networks & OSI MODEL.ppt
Dwarkadas J Sanghvi College of Engineering
 
Data Driven Maintenance | UReason Webinar
Data Driven Maintenance | UReason WebinarData Driven Maintenance | UReason Webinar
Data Driven Maintenance | UReason Webinar
UReason
 
Optimizing Gradle Builds - Gradle DPE Tour Berlin 2024
Optimizing Gradle Builds - Gradle DPE Tour Berlin 2024Optimizing Gradle Builds - Gradle DPE Tour Berlin 2024
Optimizing Gradle Builds - Gradle DPE Tour Berlin 2024
Sinan KOZAK
 
VARIABLE FREQUENCY DRIVE. VFDs are widely used in industrial applications for...
VARIABLE FREQUENCY DRIVE. VFDs are widely used in industrial applications for...VARIABLE FREQUENCY DRIVE. VFDs are widely used in industrial applications for...
VARIABLE FREQUENCY DRIVE. VFDs are widely used in industrial applications for...
PIMR BHOPAL
 

Recently uploaded (20)

SCALING OF MOS CIRCUITS m .pptx
SCALING OF MOS CIRCUITS m                 .pptxSCALING OF MOS CIRCUITS m                 .pptx
SCALING OF MOS CIRCUITS m .pptx
 
ITSM Integration with MuleSoft.pptx
ITSM  Integration with MuleSoft.pptxITSM  Integration with MuleSoft.pptx
ITSM Integration with MuleSoft.pptx
 
TIME TABLE MANAGEMENT SYSTEM testing.pptx
TIME TABLE MANAGEMENT SYSTEM testing.pptxTIME TABLE MANAGEMENT SYSTEM testing.pptx
TIME TABLE MANAGEMENT SYSTEM testing.pptx
 
Introduction to verilog basic modeling .ppt
Introduction to verilog basic modeling   .pptIntroduction to verilog basic modeling   .ppt
Introduction to verilog basic modeling .ppt
 
一比一原版(USF毕业证)旧金山大学毕业证如何办理
一比一原版(USF毕业证)旧金山大学毕业证如何办理一比一原版(USF毕业证)旧金山大学毕业证如何办理
一比一原版(USF毕业证)旧金山大学毕业证如何办理
 
Design and optimization of ion propulsion drone
Design and optimization of ion propulsion droneDesign and optimization of ion propulsion drone
Design and optimization of ion propulsion drone
 
Bayesian Decision Theory details ML.pptx
Bayesian Decision Theory details ML.pptxBayesian Decision Theory details ML.pptx
Bayesian Decision Theory details ML.pptx
 
LLM Fine Tuning with QLoRA Cassandra Lunch 4, presented by Anant
LLM Fine Tuning with QLoRA Cassandra Lunch 4, presented by AnantLLM Fine Tuning with QLoRA Cassandra Lunch 4, presented by Anant
LLM Fine Tuning with QLoRA Cassandra Lunch 4, presented by Anant
 
Use PyCharm for remote debugging of WSL on a Windo cf5c162d672e4e58b4dde5d797...
Use PyCharm for remote debugging of WSL on a Windo cf5c162d672e4e58b4dde5d797...Use PyCharm for remote debugging of WSL on a Windo cf5c162d672e4e58b4dde5d797...
Use PyCharm for remote debugging of WSL on a Windo cf5c162d672e4e58b4dde5d797...
 
smart pill dispenser is designed to improve medication adherence and safety f...
smart pill dispenser is designed to improve medication adherence and safety f...smart pill dispenser is designed to improve medication adherence and safety f...
smart pill dispenser is designed to improve medication adherence and safety f...
 
Pressure Relief valve used in flow line to release the over pressure at our d...
Pressure Relief valve used in flow line to release the over pressure at our d...Pressure Relief valve used in flow line to release the over pressure at our d...
Pressure Relief valve used in flow line to release the over pressure at our d...
 
IEEE Aerospace and Electronic Systems Society as a Graduate Student Member
IEEE Aerospace and Electronic Systems Society as a Graduate Student MemberIEEE Aerospace and Electronic Systems Society as a Graduate Student Member
IEEE Aerospace and Electronic Systems Society as a Graduate Student Member
 
Digital Twins Computer Networking Paper Presentation.pptx
Digital Twins Computer Networking Paper Presentation.pptxDigital Twins Computer Networking Paper Presentation.pptx
Digital Twins Computer Networking Paper Presentation.pptx
 
5G Radio Network Througput Problem Analysis HCIA.pdf
5G Radio Network Througput Problem Analysis HCIA.pdf5G Radio Network Througput Problem Analysis HCIA.pdf
5G Radio Network Througput Problem Analysis HCIA.pdf
 
Mechatronics material . Mechanical engineering
Mechatronics material . Mechanical engineeringMechatronics material . Mechanical engineering
Mechatronics material . Mechanical engineering
 
Applications of artificial Intelligence in Mechanical Engineering.pdf
Applications of artificial Intelligence in Mechanical Engineering.pdfApplications of artificial Intelligence in Mechanical Engineering.pdf
Applications of artificial Intelligence in Mechanical Engineering.pdf
 
Introduction to Computer Networks & OSI MODEL.ppt
Introduction to Computer Networks & OSI MODEL.pptIntroduction to Computer Networks & OSI MODEL.ppt
Introduction to Computer Networks & OSI MODEL.ppt
 
Data Driven Maintenance | UReason Webinar
Data Driven Maintenance | UReason WebinarData Driven Maintenance | UReason Webinar
Data Driven Maintenance | UReason Webinar
 
Optimizing Gradle Builds - Gradle DPE Tour Berlin 2024
Optimizing Gradle Builds - Gradle DPE Tour Berlin 2024Optimizing Gradle Builds - Gradle DPE Tour Berlin 2024
Optimizing Gradle Builds - Gradle DPE Tour Berlin 2024
 
VARIABLE FREQUENCY DRIVE. VFDs are widely used in industrial applications for...
VARIABLE FREQUENCY DRIVE. VFDs are widely used in industrial applications for...VARIABLE FREQUENCY DRIVE. VFDs are widely used in industrial applications for...
VARIABLE FREQUENCY DRIVE. VFDs are widely used in industrial applications for...
 

computer graphics-C/C++-dancingdollcode

  • 2. BASICS: Computer graphics is an art of drawing pictures on computer screens with the help of programming and algorithms. It involves computations, creation, and manipulation of data. In other words, we can say that computer graphics is a rendering tool for the generation and manipulation of images. Application of Computer Graphics 1.Computer graphics user interfaces (GUIs). 2.Business presentation graphics 3.Cartography Weather Maps 4.Satellite Imaging Photo Enhancement 5.Medical Imaging 6.Engineering drawings 7.Typography 8.Architecture Art 9.Entertainment 10.Simulation and modeling
  • 3. GRAPHICS.H Used to draw different shapes, display text in different fonts, change colors and many more. Using functions of graphics.h in Turbo C compiler you can make graphics programs, animations, projects, and games. You can draw circles, lines, rectangles, bars and many other geometrical figures. You can change their colors using the available functions and fill them. Following is a list of functions of graphics.h header file. Every function is discussed with the arguments it needs, its description GRAPHICS.H FUNCTIONS arc bar bar3d circle cleardevice closegraph drawpoly ellipse fillellipse fillpoly floodfill getarccords getbkcolor getcolor getdrivername getimage getmaxcolor getmaxx getmaxy getpixel getx gety graphdefaults grapherrormsg imagesize line lineto linerel moveto moverel outtext outtextxy pieslice putimage putpixel rectangle sector setbkcolor setcolor setfillstyle setlinestyle settextstyle setviewport textheight textwidth
  • 4. BASICS: LINE GENERATION ALGORITHM In any 2-Dimensional plane if we connect two points (x0, y0) and (x1, y1), we get a line segment. But in the case of computer graphics we can not directly join any two coordinate points, for that we should CALCULATE INTERMEDIATE POINT’S COORDINATE and put a pixel for each intermediate point, of the desired color with help of functions like putpixel(x, y, K) in C, where (x,y) is our co-ordinate and K denotes some color  DDAALGORITHM  BRESENHAM’S LINE GENERATION  MID-POINT ALGORITHM
  • 5. DDA- LINE GENERATION ALGORITHM Consider one point of the line as (X0,Y0) and the second point of the line as (X1,Y1). // calculate dx , dy dx = X1 - X0; dy = Y1 - Y0; // Depending upon absolute value of dx & dy // choose number of steps to put pixel as // steps = abs(dx) > abs(dy) ? abs(dx) : abs(dy) steps = abs(dx) > abs(dy) ? abs(dx) : abs(dy); // calculate increment in x & y for each steps Xinc = dx / (float) steps; Yinc = dy / (float) steps; // Put pixel for each step X = X0; Y = Y0; for (int i = 0; i <= steps; i++) { putpixel (X,Y,WHITE); X += Xinc; Y += Yinc; }
  • 6. BASICS: CIRCLE GENERATION ALGORITHM  Drawing a circle on the screen is a little complex than drawing a line. There are two popular algorithms for generating a circle: Bresenham’s Algorithm and Midpoint Circle Algorithm. These algorithms are based on the idea of determining the subsequent points required to draw the circle. Bresenham’s Algorithm: Step 1 − Get the coordinates of the center of the circle and radius, and store them in x, y, and R respectively. Set P=0 and Q=R. Step 2 − Set decision parameter D = 3 – 2R. Step 3 − Repeat through step-8 while P ≤ Q. Step 4 − Call Draw Circle X,Y,P,QX,Y,P,Q. Step 5 − Increment the value of P. Step 6 − If D < 0 then D = D + 4P + 6. Step 7 − Else Set R = R - 1, D = D + 4P−QP−Q + 10. Step 8 − Call Draw Circle X,Y,P,Q. putpixel (X + P, Y + Q) putpixel (X - P, Y + Q) putpixel (X + P, Y - Q) putpixel (X - P, Y - Q) putpixel (X + Q, Y + P) putpixel (X - Q, Y + P) putpixel (X + Q, Y - P) putpixel (X - Q, Y - P)
  • 7. BASICS: POLYGON FILLING Polygon is an ordered list of vertices as shown in the following figure. For filling polygons with particular colors, you need to determine the pixels falling on the border of the polygon and those which fall inside the polygon. Scan Line Algorithm Flood Fill Algorithm Boundary Fill Algorithm 4-Connected Polygon 8-Connected Polygon Inside-outside Test : 1. Odd-Even Rule 2.Nonzero winding number rule
  • 8. COMPUTER ANIMATION The basic idea behind animation is to play back the recorded images at the rates fast enough to fool the human eye into interpreting them as continuous motion. Animation can make a series of dead images come alive. Animation can be used in many areas like entertainment, computer aided-design, scientific visualization, training, education, e-commerce, and computer art. Traditional Animation (frame by frame) : Key Framing  A keyframe is a frame where we define changes in animation. Every frame is a keyframe when we create frame by frame animation. When someone creates a 3D animation on a computer, they usually don’t specify the exact position of any given object on every single frame. They create keyframes.  Keyframes are important frames during which an object changes its size, direction, shape or other properties. The computer then figures out all the in-between frames and saves an extreme amount of time for the animator. The following illustrations depict the frames drawn by user and the frames generated by computer.
  • 10. DANCING DOLL: CODE & OUTPUT