#include "stdio.h" #include "graphics.h" #include "stdlib.h" #include "math.h" #define GRAPH #define DIFFRACT #define MAX_X 300 #define MAX_Y 200 int dz = 40; float lambda = /*1*/ /*3*/ /*10*/ 0.3; #ifndef DIFFRACT #define NSOURCES 2 int sources[NSOURCES][2] = { { 100, 80 }, { 200, 110 } }; #else #define MAXSOURCES 2000 int sources[MAXSOURCES][2]; int NSOURCES; #endif float rayon_source = 1.5; defsources () { #ifdef DIFFRACT long x, y, dx, dy, i, d2; float d1; i = 0; for (x=1; x a*a*25) */ /* if (a*a > 2) */ #ifdef DIFFRACT /* if (2*a > NSOURCES) */ /* if (1.01*a > NSOURCES) */ /* if (a*2 > NSOURCES) */ /* if (a*20 > random (NSOURCES*20)) */ /* if (a < 6.5) */ /* if (a < 1.5) */ /* if (a < 3) */ /* if (a < 1) */ if (a*alpha < beta + NSOURCES*gamma) #else if (a*2 > NSOURCES) #endif { putpixel (x, y/2, 1); } #endif } interf () { long x, y, dx, dy, i, d2; float a, b, d1, fd2; for (y=2; y