/*************************************************************************************************************************************/
/* */
/* E T U D E D E L A C O M P L E X I T E S T R U C T U R E L L E */
/* D ' U N E C O U R B E D E H I L B E R T : */
/* */
/* */
/* Author of '$xrC/ObjetComplexe.I1$vv$c' : */
/* */
/* Jean-Francois Colonna (LACTAMME, 20130614185344). */
/* */
/*************************************************************************************************************************************/
#ifdef COMMENTS
# undef COMMENTS
#else
#endif
#define COMMENTS "Courbe de Hilbert (format octet) -noir ou blanc-"
#define DEFINE_01 "-DPROFONDEUR=3"
#define DEFINE_02 "-DPROFONDEUR=5"
#define DEFINE_03 "-DPROFONDEUR=7"
#define DEFINE_04 "-DPROFONDEUR=9"
#include "images_1octet.01.vv.I"
#include "Fpuissance.01.vv.I"
#ifndef PROFONDEUR
# define PROFONDEUR \
(6) \
/* On notera qu'une 'PROFONDEUR' egale a 11 remplit exactement un carre 'Sdu'. */
#else
#endif
#define REGLE_PLUS___ \
{ \
int new_deplacement_X=-deplacement_Y; \
int new_deplacement_Y=+deplacement_X; \
deplacement_X=new_deplacement_X; \
deplacement_Y=new_deplacement_Y; \
} \
/* Regle "+" (rotation de +pi/2, soir une multiplication par '+i'). */
#define REGLE_MOINS__ \
{ \
int new_deplacement_X=+deplacement_Y; \
int new_deplacement_Y=-deplacement_X; \
deplacement_X=new_deplacement_X; \
deplacement_Y=new_deplacement_Y; \
} \
/* Regle "-" (rotation de -pi/2, soir une multiplication par '-i'). */
int longueur;
#define REGLE_FORWARD \
{ \
int n; \
\
for (n=1 ; n <= longueur ; n=ADD2(n,1)) \
{ \
STORE_IMAGE_PLAN(point_courant_X,point_courant_Y,BLANC); \
\
point_courant_X=ADD2(point_courant_X,deplacement_X); \
point_courant_Y=ADD2(point_courant_Y,deplacement_Y); \
} \
\
STORE_IMAGE_PLAN(point_courant_X,point_courant_Y,BLANC); \
/* Marquage du dernier point... */ \
} \
/* Regle "F" (deplacement en avant). */
#define REGLE_RIGHT__ \
{ \
GenerationDeLaCourbeDeHilbert_R(profondeur-1); \
} \
/* Regle "R" (deplacement a droite -"Right"-). */
#define REGLE_LEFT___ \
{ \
GenerationDeLaCourbeDeHilbert_L(profondeur-1); \
} \
/* Regle "L" (deplacement a gauche -"Left"-). */
int point_courant_X;
int point_courant_Y;
int deplacement_X=1;
int deplacement_Y=0;
int GenerationDeLaCourbeDeHilbert_R(profondeur)
int profondeur;
{
if (profondeur > 0)
{
REGLE_MOINS__;
REGLE_LEFT___;
REGLE_FORWARD;
REGLE_PLUS___;
REGLE_RIGHT__;
REGLE_FORWARD;
REGLE_RIGHT__;
REGLE_PLUS___;
REGLE_FORWARD;
REGLE_LEFT___;
REGLE_MOINS__;
/* Reecriture : */
/* */
/* R --> -LF+RFR+FL- */
/* */
/* qui est le "complement" de : */
/* */
/* L --> +RF-LFL-FR+ */
/* */
}
else
{
}
}
int GenerationDeLaCourbeDeHilbert_L(profondeur)
int profondeur;
{
if (profondeur > 0)
{
REGLE_PLUS___;
REGLE_RIGHT__;
REGLE_FORWARD;
REGLE_MOINS__;
REGLE_LEFT___;
REGLE_FORWARD;
REGLE_LEFT___;
REGLE_MOINS__;
REGLE_FORWARD;
REGLE_RIGHT__;
REGLE_PLUS___;
/* Reecriture : */
/* */
/* L --> +RF-LFL-FR+ */
/* */
/* qui est le "complement" de : */
/* */
/* R --> -LF+RFR+FL- */
/* */
}
else
{
}
}
MAIN(
{
int profondeur=PROFONDEUR;
INITIALISATION_IMAGE(NOIR);
longueur=DIVI(DIVI(dimXY,2),Fpuissance(2,SOUS(profondeur,2)));
point_courant_X=ADD2(Xmin,DIVI(longueur,2));
point_courant_Y=ADD2(Ymin,DIVI(longueur,2));
REGLE_LEFT___;
SORTIE_DU_FICHIER_IMAGE;
EDITER_LES_COMPTEURS_DES_FONCTIONS;
}
)