├── Program 1 └── p1.c ├── Program 2 └── p2.c ├── Program-3 └── 3.c ├── README.md └── src ├── SRC.md ├── color models └── hsv.c └── robots.txt /Program 1/p1.c: -------------------------------------------------------------------------------- 1 | // DDA Line generation algorithm implementation in c 2 | 3 | #include 4 | #include 5 | 6 | int abs (int n){ 7 | return ((n>0) ? n : ( n * (-1))); 8 | } 9 | 10 | void DDA(int X0, int Y0, int X1, int Y1){ 11 | int dx = X1 - X0; 12 | int dy = Y1 - Y0; 13 | 14 | int steps = abs(dx) > abs(dy) ? abs(dx) : abs(dy); 15 | 16 | float Xinc = dx / (float) steps; 17 | float Yinc = dy / (float) steps; 18 | 19 | float X = X0; 20 | float Y = Y0; 21 | for (int i = 0; i <= steps; i++){ 22 | putpixel (X,Y,RED); 23 | X += Xinc; 24 | Y += Yinc; 25 | delay(300); 26 | } 27 | } 28 | 29 | 30 | int main(){ 31 | int gd = DETECT, gm; 32 | initgraph (&gd, &gm, ""); 33 | 34 | int t; 35 | scanf("%d", &t); 36 | 37 | while(t--){ 38 | int x0, x1, y0, y2; 39 | scanf("%d%d%d%d", &x0, &x1, &y0, &y1); 40 | DDA(x0, y0, x1, y1); 41 | } 42 | return 0; 43 | } 44 | -------------------------------------------------------------------------------- /Program 2/p2.c: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /Program-3/3.c: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # CSE-215-Computer-Graphics-Programs 2 | Computer Programs for departmental elective subject Computer Graphics (CSE-215). There is no lab for this subject in college, but I'll prepare programs for it whatsoever. 3 | 4 | **Edit_0:** All the programs and script files are now in building phase and is supposed to be uploaded at the end of the semester. Keep Waiting :( But I'll make sure upload of at least one new file time to time. 5 | -------------------------------------------------------------------------------- /src/SRC.md: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /src/color models/hsv.c: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /src/robots.txt: -------------------------------------------------------------------------------- 1 | 2 | --------------------------------------------------------------------------------