Sunteți pe pagina 1din 4

Skip to content C / C++ PYTHON JAVA JAVASCRIPT HTML ORACLE QGIS SUBMIT YOUR CODE CPROGRAMTO.COM cprogramto.com ?

c program for multiplying digits of numberc program for first come first serve scheduling ? c program for dda algorithm Posted on January 20, 2013 by admin

C program for dda algorithm. DDA (Digital Differential Analyzer) Algorithm also know as Vector Generation algorithm. Why DDA algorithm ? DDA Algorithm is used to plot line between two nodes i.e two end points in compu ter system. While our computer understand pixels, if we want to plot a line, we should have maximum intermediate vertices of the line i.e intermediate points, so as to gene rate a straight line. Here DDA does the same. c program for dda algorithm : #include <graphics.h> #include <stdio.h> #include <math.h> int main( ) { float x,y,x1,y1,x2,y2,dx,dy,pixel; int i,gd,gm; printf("Enter the scanf("%f",&x1); printf("Enter the scanf("%f",&y1); printf("Enter the scanf("%f",&x2); printf("Enter the scanf("%f",&y2); value of x1 : "); value of y1 : "); value of x2 : "); value of y1 : ");

detectgraph(&gd,&gm); initgraph(&gd,&gm,""); dx=abs(x2-x1); dy=abs(y2-y1); if(dx>=dy)

pixel=dx; else pixel=dy; dx=dx/pixel; dy=dy/pixel; x=x1; y=y1; i=1; while(i<=pixel) { putpixel(x,y,1); x=x+dx; y=y+dy; i=i+1; delay(100); } getch(); closegraph(); } Output : C program for DDA algorithm C program for DDA algorithm C program to implement DDA algorithm in Graphics DDA algorithm : Define the nodes, i.e end points in form of (x1,y1) and (x2,y2). Calculate the distance between the two end points vertically and horizontally, i .e dx=|x1-x2| and dy=|y1-y2|. Define new variable name pixel , and compare dx and dy values, if dx > dy then pixel=dx else pixel =dy. dx=dx/pixel and dy=dy/pixel x=x1; y=y1; while (i<=pixel) compute the pixel and plot the pixel with x=x+dx and y=y+dy. If you are having any problem related to the post, do comment below.

"Please Do Like Facebook Page and follow us on Twitter so that you can actively participate and develop skills in programming. If you find above post interestin g do share the webpage." This entry was posted in c program and tagged graphics program. Bookmark the per malink.

? c program for multiplying digits of numberc program for first come first serve scheduling ? One Response to c program for dda algorithm Prayag khannal says: August 11, 2013 at 9:22 am Why didn t you do the rounding in this program? Reply Leave a Reply Your email address will not be published. Required fields are marked * Name * Email * Website Comment You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em > <i> <q cite=""> <strike> <strong>

Email Newsletter Enter your email address:

Delivered by FeedBurner JOIN US ON FACEBOOK JOIN US ON GOOGLE PLUS Recent Posts c++ access specifier public private protected c# array declaration initialization accessing C program for ASCII number from ASCII code css z index css depth C program for ASCII code of number ASCII code print c program c program for endianess Little endian or Big endian Convert byte to long in c++ program c++ program to find shortest distance between point and line segment singleton pattern in c++ program Related Posts C program for ASCII number from ASCII code C program for ASCII code of number ASCII code print c program c program for endianess - Little endian or Big endian C program to write into a file C program to read file C program for dfs (depth first search) C program for bfs (breadth first search) c program for prime number C program to find prime number efficient in less time Popular Posts doubly linked list c code delete insert c program for queue using array

convert decimal to binary c code c program for first come first serve scheduling Implementation of Stack using linked list in c code Implement queue using linked list in c code java program to convert decimal to binary circular queue c program implementation c program for linked list c program to print pyramid Categories Android c program C# asp .Net c++ css HTML java JavaScript Linux oracle python code QGIS Archives August 2013 July 2013 June 2013 May 2013 April 2013 March 2013 February 2013 January 2013 Topics ada Armstrong number array ASCII code basic program Byte converter Compound Inte rest Code constraint conversion programs create data structure distance calculat e factorial number Fibonacci sequence file system game programming graphics prog ram largest number leap year linked list maximum number Minimum Number multiplic ation table multiplying digits operating system scheduling palindrome number pas cal triangle power prime number print pyramid QGIS Oracle connection queue read read file recursion relative prime soft computing sorting program stack string s um of digits swap test for divisibility tic tac toe toc Alexa Certified Site Stats for cprogramto.com Copyright 2013 All Rights Reserved | Sitemap | Disclaimer | Privacy Policy | Abo ut cprogramto.com Proudly powered by WordPress.

S-ar putea să vă placă și