/************************************************************************** * FRACTALS: HENON'S ATTRACTORS * * ----------------------------------------------------------------------- * * TUTORIAL: * * * * The french politician and mathematician Poincaré highlighted the com- * * plexity of planet trajectories that simple laws of celestial mechanics * * do not show at first. A typical example is the movement of the Earth * * around the sun, everybody knows that the period is one year long. This * * is only true in first approximation, but not if you take into conside- * * ration all the small perturbations caused by the other planets ! * * * * Periodic trajectories are useful for at least two reasons: * * * * 1) they can be predicted with accuracy by Kepler's laws, * * * * 2) it is possible to describe conveniently the small trajectory * * variations by using the following: * * * * Let be T the basic periodic trajectory that we intercept by a fixed, * * perpendicular plane, and O the point, taken as origin, of the plane * * intercepted by the T trajectory. At next periods, the trajectory with * * its small variations will meet the same plane at nearby points A0, A1, * * A2 etc. * * * * This allows us to replace a complex problem of 3D trajectories by a * * simpler problem of 2D representation of points. * * * * The french mathematician Hénon described in 1969 a dynamic system which * * illustrates the proposed method: * * * * x n+1 = x n cos a - ( y n - x n² ) sin a * * y n+1 = x n sin a + ( y n - x n² ) cos a * * * * a, being the angle of basic trajectory with respect to the observation * * plane (in radians). * * * * The program randomly chooses an angle a (usually between 0.5 and 2.0 * * radians). The number of iterations equals arbitrarily 200. * * * * As one can see, caracreristic figures are obtained, the points have a * * noticeable tendancy to agglutinate themselves in particular "zones of * * attraction". * * ----------------------------------------------------------------------- * * REFERENCE: * * "Graphisme dans le plan et dans l'espace avec Turbo Pascal 4.0 * * By R. Dony - MASSON, Paris 1990" [BIBLI 12]. * * * * Microsoft Visual C++ version in API style by J-P Moreau * * (Program to use with Henon.mak and Gr2D.cpp) * * (www.jpmoreau.fr) * **************************************************************************/ #include #include #include #include HDC hdc; RECT rect; //Functions of module Gr2D.cpp void Fenetre(double,double,double,double); void Cloture(int,int,int,int); void Bordure(); void Axes(); void Gradue(double,double); void Grille(double,double); 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; float dx,dy; if (ix2