• Tidak ada hasil yang ditemukan

In computer graphics, a

N/A
N/A
Protected

Academic year: 2024

Membagikan "In computer graphics, a"

Copied!
2
0
0

Teks penuh

(1)

E-content for B.Sc(H) Computer Sc. Sem VI Paper-Computer Graphics Topic-DDA CVS,DU C++ Program to implement Digital differential analyzer (DDA graphics algorithm)

In computer graphics, a digital differential analyzer (DDA) is hardware or software used for linear interpolation of variables over an interval between start and end point. DDAs are used for rasterization of lines, triangles and polygons. In its simplest implementation, the DDA algorithm interpolates values in interval by computing for each xi the equations xi = xi−1+1/m, yi = yi−1 + m, where Δx = xend − xstart and Δy = yend − ystart and m = Δy/Δx

Program

#include <iostream.h>

#include <conio.h>

#include <graphics.h>

#include <math.h>

#include <process.h>

void main() {

float i,x1,x2,y1,y2,dx,dy,x,y,step,xinr,yinr;

int gd=DETECT,gm;

clrscr();

initgraph(&gd,&gm,"C:\\TURBOC3\\BGI");

cout<<"Enter the values\n";

cin>>x1>>y1>>x2>>y2;

dx=x2-x1;

dy=y2-y1;

if(dx==0&&dy==0) {

putpixel(x1,y1,15);

getch();

exit(0);

}

if(abs(dx)>=abs(dy)) step=abs(dx);

else

step=abs(dy);

xinr=dx⁄step;

yinr=dy⁄step;

x=x1;

y=y1;

for(i=1;i<=step;i++) {

putpixel(x,y,15);

(2)

E-content for B.Sc(H) Computer Sc. Sem VI Paper-Computer Graphics Topic-DDA CVS,DU x=x+xinr;

y=y+yinr;

}

getch();

closegraph();

}

Referensi

Dokumen terkait

Computer is a combination of analog and digital device which is used to compute complex mathematical problems.. It is basically a programmable electronic device which performs

Jacob is investigating formal specification techniques for describing user-computer interaction for both the design and construction of user interfaces for computer systems..

The investigative learning materials in the topic of reflection for grade VII developed in this study include lesson plan, computer- based learning media,

b Results of interviews and student response sheets on the use of computer-based interactive mathematics learning media on the topic of flat plane geometry, the average student answers

Based on the implementation and testing of the visitor monitoring system with the YOLO algorithm using a single board computer, the following conclusions can be drawn: Firstly, the

Embedding interactive video clips into a POE sequence using a computer program The interactive digital video computer program reported in this paper attempts to make use of digital

,4 Hybrid Computer for X-Ray Crystallography 161 Evidently the computer functions a s a digital computer with analog function generators and actually goes through the following

Digital Tools Acceptance in Open Distance Learning ODL among Computer Science Students during COVID-19 Pandemic: A Comparative Study Rajeswari Raju1*, Nur Hidayah Md Noh2, Siti