C Program Of Dda Line Drawing Algorithm

C Program Of Dda Line Drawing Algorithm 8,3/10 4494 reviews
Program

See More On Stackoverflow

Drawing

Dda Line Drawing Algorithm Program In C

DDA refers to Digital Differential Analyzer. DDA Line Drawing Algorithm: Step 1: Get the endpoints of a line from the user. (X start, Y start) and (X end, Y end) are the end points of a line. Step 2: Calculate dx and dy. Dx = X end - X start dy = Y end - Y start Step 3: Calculate the slope 'm' m = dx / dy; Step 4: If slope is less than or equal to 1( m 1), then the X and Y successors are calculated as follows. Y k + 1 = Y k + 1 X k + 1 = X k + (1 / m) k starts from 1 and get incremented by 1 until endpoint(Y end) is reached.

The c program for DDA line drawing algorithm rounds off the line coordinates to an integer which is an approximation to the expected line. However, the round operations in the algorithm are too inefficient.

Write a C program to implement DDA line drawing algorithm.

Dda Line Drawing Algorithm Program In C

↓. Jadrankoo The answer on james question is: YES, you can compile it under CodeBlocks.

C Program Of Dda Line Drawing Algorithm

But, let’s read some facts. Well, first of all, CodeBlocks is just an IDE (kind of “smart” editor”) – compile process is automaticaly done calling Mingw compiler (in fact GCC) – very powerfull one Graphics in this and similar examples is so called BGI graphics (Borland Graphics Interface), produced in times of DOS Today, in the world of 32/64 bit operating systems and applications you have to install Code Blocks 10.05 (you can find it on: ). This is most simple way, because it is 32 bit system (very important: you can’t use 64 bit compiler for BGI). Then you have to copy file: 1. Graphics.h into folder CodeBlocks MinGW include 2. Libbgi.a into folder CodeBlocks MinGW lib And also put this in CodeBlocks Settings – Compiler settings – Linker settings, into write window (Other linker settings) (type it strictly as it is here: -lbbgi -lgdi32 -lcomdlg32 -lole32 -loleaut32 -luuid and every code you save, writen in C (not C) – save with extension.cpp (will not work as.c) Don’t forget #include.for more details see.

Comments are closed.