/******************************************************************* * FRACTAL CURVES * * ---------------------------------------------------------------- * * This program generates a fractal curve using the formula: * * x' = x(x2-x1) - y(y2-y1) + x1 * * y' = x(y2-y1) + y(x2-x1) + y1 * * using a basis composed of segments (such as a single segment, a * * square, a triangle etc.) forming a closed figure, and a genera- * * trix simple open figure, such as two bits of line at 60°. * * The basis is memorized by its summit coordinates stored in two * * tables Xbasis and Ybasis. The generatrix is stored in the same * * way in tables Xgen and Ygen. * * ---------------------------------------------------------------- * * REFERENCE: * * "Graphisme dans le plan et dans l'espace avec Turbo-Pascal 4.0 * * By R. Dony - MASSON, Paris 1990" [BIBLI 12]. * * * * Visual C++ version by J-P Moreau, Paris * * (use with fractals.mak and gr2d.cpp) * * (www.jpmoreau.fr) * *******************************************************************/ #include #include #include #include HDC hdc; RECT rect; HPEN hpen, hpenOld; //Functions used here of module Gr2D.cpp void Fenetre(double,double,double,double); void Cloture(int,int,int,int); void Bordure(); void PleinEcran(); void MoveXY(double,double); void LineXY(double,double); //"home made" graphic commands for hdc environment used by above functions void DrawPixel(int ix,int iy) { //sorry, no other available command found Rectangle(hdc,rect.left+ix,rect.top+iy, rect.left+ix+2,rect.top+iy+1); } void Swap(int *i1,int *i2) { int it; it=*i1; *i1=*i2; *i2=it; } void DrawLine(int ix1,int iy1,int ix2,int iy2) { int i,il,ix,iy; double dx,dy; if (ix2