_______________________________________________________________________________________________________________________________________
/*************************************************************************************************************************************/
/* */
/* F O N C T I O N S Q U I N E P E U V E N T E T R E D E S " D E F I N E S " : */
/* */
/* */
/* Definition : */
/* */
/* Dans ce fichier, se trouvent toutes */
/* les fonctions primitives d'acces aux */
/* pixels d'une image qui ne peuvent */
/* etre des "defines" pour des raisons */
/* de compilation... */
/* */
/* */
/* N O T A T I O N S : */
/* */
/* */
/* On notera 'imageA' les images Arguments, */
/* et 'imageR' les images Resultats ; 'arg' */
/* designera des arguments, et 'Vf' une */
/* fonction "variable"... */
/* */
/* */
/* Author of '$xiipf/fonction.3$FON' : */
/* */
/* Jean-Francois COLONNA (LACTAMME, 19870000000000). */
/* */
/*************************************************************************************************************************************/
/*===================================================================================================================================*/
/*************************************************************************************************************************************/
/* */
/* C O N V E R S I O N D ' U N E A B S C I S S E E N U N I N D I C E : */
/* */
/*************************************************************************************************************************************/
BFonctionI
/* Je note le 20170712164739 que '__VERSION__INDEXATION_SIMPLIFIEE_A_PRIORI' ne doit pas */
/* etre teste ici afin de rendre la fonction 'Findice_X(...)' conditionnelle car, en effet, */
/* les librairies n'utilisent pas toutes '__VERSION__INDEXATION_SIMPLIFIEE_A_PRIORI' a un */
/* instant donne... */
DEFV(Common,DEFV(FonctionI,Findice_X(X,Y)))
DEFV(Argument,DEFV(Int,X));
DEFV(Argument,DEFV(Int,Y));
/* Abscisse 'X' et ordonnee 'Y' courantes. */
/*-----------------------------------------------------------------------------------------------------------------------------------*/
Bblock
/*..............................................................................................................................*/
RETU(INDX(MODU(ADD2(INTX(DEFORMATION_OX(X,Y))
,translationX
)
,Xmin
,Xmax
)
,Xmin
)
);
Eblock
EFonctionI
/*===================================================================================================================================*/
/*************************************************************************************************************************************/
/* */
/* C O N V E R S I O N D ' U N E O R D O N N E E E N U N I N D I C E : */
/* */
/*************************************************************************************************************************************/
BFonctionI
/* Je note le 20170712164739 que '__VERSION__INDEXATION_SIMPLIFIEE_A_PRIORI' ne doit pas */
/* etre teste ici afin de rendre la fonction 'Findice_Y(...)' conditionnelle car, en effet, */
/* les librairies n'utilisent pas toutes '__VERSION__INDEXATION_SIMPLIFIEE_A_PRIORI' a un */
/* instant donne... */
DEFV(Common,DEFV(FonctionI,Findice_Y(X,Y)))
DEFV(Argument,DEFV(Int,X));
DEFV(Argument,DEFV(Int,Y));
/* Abscisse 'X' et ordonnee 'Y' courantes. */
/*-----------------------------------------------------------------------------------------------------------------------------------*/
Bblock
/*..............................................................................................................................*/
RETU(INDX(MODU(ADD2(INTY(DEFORMATION_OY(X,Y))
,translationY
)
,Ymin
,Ymax
)
,Ymin
)
);
Eblock
EFonctionI
/*===================================================================================================================================*/
/*************************************************************************************************************************************/
/* */
/* C O N V E R S I O N D ' U N E P R O F O N D E U R E N U N I N D I C E : */
/* */
/*************************************************************************************************************************************/
BFonctionI
/* Je note le 20170712164739 que '__VERSION__INDEXATION_SIMPLIFIEE_A_PRIORI' ne doit pas */
/* etre teste ici afin de rendre la fonction 'Findice_Z(...)' conditionnelle car, en effet, */
/* les librairies n'utilisent pas toutes '__VERSION__INDEXATION_SIMPLIFIEE_A_PRIORI' a un */
/* instant donne... */
DEFV(Common,DEFV(FonctionI,Findice_Z(X,Y,Z)))
DEFV(Argument,DEFV(Int,X));
DEFV(Argument,DEFV(Int,Y));
DEFV(Argument,DEFV(Int,Z));
/* Abscisse 'X', ordonnee 'Y' et profondeur 'Z' courantes. */
/*-----------------------------------------------------------------------------------------------------------------------------------*/
Bblock
/*..............................................................................................................................*/
RETU(INDX(MODU(ADD2(INTZ(DEFORMATION_OZ(X,Y,Z))
,translationZ
)
,Zmin
,Zmax
)
,Zmin
)
);
Eblock
EFonctionI
/*===================================================================================================================================*/
/*************************************************************************************************************************************/
/* */
/* C O N V E R S I O N D ' U N T E M P S E N U N I N D I C E : */
/* */
/*************************************************************************************************************************************/
BFonctionI
DEFV(Common,DEFV(FonctionI,Findice_T(X,Y,Z,T)))
DEFV(Argument,DEFV(Int,X));
DEFV(Argument,DEFV(Int,Y));
DEFV(Argument,DEFV(Int,Z));
DEFV(Argument,DEFV(Int,T));
/* Abscisse 'X', ordonnee 'Y', profondeur 'Z' et temps 'T' courants. */
/*-----------------------------------------------------------------------------------------------------------------------------------*/
Bblock
/*..............................................................................................................................*/
RETU(INDX(MODU(ADD2(INTT(DEFORMATION_OT(X,Y,Z,T))
,translationT
)
,Tmin
,Tmax
)
,Tmin
)
);
Eblock
EFonctionI
_______________________________________________________________________________________________________________________________________
_______________________________________________________________________________________________________________________________________
/*===================================================================================================================================*/
/*************************************************************************************************************************************/
/* */
/* D E N O R M A L I S A T I O N D E L A C O O R D O N N E E ' X ' : */
/* */
/*************************************************************************************************************************************/
BFonctionI
DEFV(Common,DEFV(FonctionI,fV_cDENORMALISE_OX(Xf)))
/* Fonction introduite le 20101119132724 pour alleger 'v $ximcf/conformes$FON'. */
DEFV(Argument,DEFV(Float,Xf));
/* Abscisse 'X' courante. */
/*-----------------------------------------------------------------------------------------------------------------------------------*/
Bblock
/*..............................................................................................................................*/
RETU(V_cDENORMALISE_OX(Xf));
Eblock
EFonctionI
/*===================================================================================================================================*/
/*************************************************************************************************************************************/
/* */
/* D E N O R M A L I S A T I O N D E L A C O O R D O N N E E ' Y ' : */
/* */
/*************************************************************************************************************************************/
BFonctionI
DEFV(Common,DEFV(FonctionI,fV_cDENORMALISE_OY(Yf)))
/* Fonction introduite le 20101119132724 pour alleger 'v $ximcf/conformes$FON'. */
DEFV(Argument,DEFV(Float,Yf));
/* Ordonnee 'Y' courante. */
/*-----------------------------------------------------------------------------------------------------------------------------------*/
Bblock
/*..............................................................................................................................*/
RETU(V_cDENORMALISE_OY(Yf));
Eblock
EFonctionI
/*===================================================================================================================================*/
/*************************************************************************************************************************************/
/* */
/* D E N O R M A L I S A T I O N D E L A C O O R D O N N E E ' Z ' : */
/* */
/*************************************************************************************************************************************/
BFonctionI
DEFV(Common,DEFV(FonctionI,fV_cDENORMALISE_OZ(Zf)))
/* Fonction introduite le 20120323072315 par symetrie avec 'fV_cDENORMALISE_OX(...)' et */
/* 'fV_cDENORMALISE_OY(...)'. */
DEFV(Argument,DEFV(Float,Zf));
/* Profondeur 'Z' courante. */
/*-----------------------------------------------------------------------------------------------------------------------------------*/
Bblock
/*..............................................................................................................................*/
RETU(V_cDENORMALISE_OZ(Zf));
Eblock
EFonctionI
_______________________________________________________________________________________________________________________________________
_______________________________________________________________________________________________________________________________________
/*===================================================================================================================================*/
/*************************************************************************************************************************************/
/* */
/* N O R M A L I S A T I O N Q U E L C O N Q U E S U R L ' A X E ' OX ' : */
/* */
/*************************************************************************************************************************************/
BFonctionF
DEFV(Common,DEFV(Float,SINT(f____cNORMALISE_OX_____borne_inferieure,COORDONNEE_BARYCENTRIQUE_MINIMALE)));
DEFV(Common,DEFV(Float,SINT(f____cNORMALISE_OX_____borne_superieure,COORDONNEE_BARYCENTRIQUE_MAXIMALE)));
/* Bornes de normalisation courantes. */
DEFV(Common,DEFV(FonctionF,f____cNORMALISE_OX(cX)))
/* Fonction introduite le 20120323072315 par symetrie avec 'f____cNORMALISE_OZ(...)'. */
DEFV(Argument,DEFV(Int,cX));
/* Abscisse 'cX' courante. */
/*-----------------------------------------------------------------------------------------------------------------------------------*/
Bblock
/*..............................................................................................................................*/
RETU(DENO(_____cNORMALISE_OX(cX)
,f____cNORMALISE_OX_____borne_inferieure
,f____cNORMALISE_OX_____borne_superieure
)
);
Eblock
EFonctionF
BFonctionF
DEFV(Common,DEFV(Float,SINT(f____lNORMALISE_OX_____borne_inferieure,COORDONNEE_BARYCENTRIQUE_MINIMALE)));
DEFV(Common,DEFV(Float,SINT(f____lNORMALISE_OX_____borne_superieure,COORDONNEE_BARYCENTRIQUE_MAXIMALE)));
/* Bornes de normalisation courantes. */
DEFV(Common,DEFV(FonctionF,f____lNORMALISE_OX(lX)))
/* Fonction introduite le 20120323072315 par symetrie avec 'f____cNORMALISE_OX(...)'. */
DEFV(Argument,DEFV(Int,lX));
/* Longueur 'cX' courante. */
/*-----------------------------------------------------------------------------------------------------------------------------------*/
Bblock
/*..............................................................................................................................*/
RETU(DENO(_____lNORMALISE_OX(lX)
,f____lNORMALISE_OX_____borne_inferieure
,f____lNORMALISE_OX_____borne_superieure
)
);
Eblock
EFonctionF
/*===================================================================================================================================*/
/*************************************************************************************************************************************/
/* */
/* N O R M A L I S A T I O N Q U E L C O N Q U E S U R L ' A X E ' OY ' : */
/* */
/*************************************************************************************************************************************/
BFonctionF
DEFV(Common,DEFV(Float,SINT(f____cNORMALISE_OY_____borne_inferieure,COORDONNEE_BARYCENTRIQUE_MINIMALE)));
DEFV(Common,DEFV(Float,SINT(f____cNORMALISE_OY_____borne_superieure,COORDONNEE_BARYCENTRIQUE_MAXIMALE)));
/* Bornes de normalisation courantes. */
DEFV(Common,DEFV(FonctionF,f____cNORMALISE_OY(cY)))
/* Fonction introduite le 20120323072315 par symetrie avec 'f____cNORMALISE_OZ(...)'. */
DEFV(Argument,DEFV(Int,cY));
/* Ordonnee 'cY' courante. */
/*-----------------------------------------------------------------------------------------------------------------------------------*/
Bblock
/*..............................................................................................................................*/
RETU(DENO(_____cNORMALISE_OY(cY)
,f____cNORMALISE_OY_____borne_inferieure
,f____cNORMALISE_OY_____borne_superieure
)
);
Eblock
EFonctionF
BFonctionF
DEFV(Common,DEFV(Float,SINT(f____lNORMALISE_OY_____borne_inferieure,COORDONNEE_BARYCENTRIQUE_MINIMALE)));
DEFV(Common,DEFV(Float,SINT(f____lNORMALISE_OY_____borne_superieure,COORDONNEE_BARYCENTRIQUE_MAXIMALE)));
/* Bornes de normalisation courantes. */
DEFV(Common,DEFV(FonctionF,f____lNORMALISE_OY(lY)))
/* Fonction introduite le 20120323072315 par symetrie avec 'f____cNORMALISE_OY(...)'. */
DEFV(Argument,DEFV(Int,lY));
/* Longueur 'cY' courante. */
/*-----------------------------------------------------------------------------------------------------------------------------------*/
Bblock
/*..............................................................................................................................*/
RETU(DENO(_____lNORMALISE_OY(lY)
,f____lNORMALISE_OY_____borne_inferieure
,f____lNORMALISE_OY_____borne_superieure
)
);
Eblock
EFonctionF
/*===================================================================================================================================*/
/*************************************************************************************************************************************/
/* */
/* N O R M A L I S A T I O N Q U E L C O N Q U E S U R L ' A X E ' OZ ' : */
/* */
/*************************************************************************************************************************************/
BFonctionF
DEFV(Common,DEFV(Float,SINT(f____cNORMALISE_OZ_____borne_inferieure,COORDONNEE_BARYCENTRIQUE_MINIMALE)));
DEFV(Common,DEFV(Float,SINT(f____cNORMALISE_OZ_____borne_superieure,COORDONNEE_BARYCENTRIQUE_MAXIMALE)));
/* Bornes de normalisation courantes. */
DEFV(Common,DEFV(FonctionF,f____cNORMALISE_OZ(cZ)))
/* Fonction introduite le 20120323072315 lors de l'etude du probleme decrit dans */
/* 'v $xiii/di_album$FON 20120321113814'... */
DEFV(Argument,DEFV(Int,cZ));
/* Profondeur 'cZ' courante. */
/*-----------------------------------------------------------------------------------------------------------------------------------*/
Bblock
/*..............................................................................................................................*/
RETU(DENO(_____cNORMALISE_OZ(cZ)
,f____cNORMALISE_OZ_____borne_inferieure
,f____cNORMALISE_OZ_____borne_superieure
)
);
Eblock
EFonctionF
BFonctionF
DEFV(Common,DEFV(Float,SINT(f____lNORMALISE_OZ_____borne_inferieure,COORDONNEE_BARYCENTRIQUE_MINIMALE)));
DEFV(Common,DEFV(Float,SINT(f____lNORMALISE_OZ_____borne_superieure,COORDONNEE_BARYCENTRIQUE_MAXIMALE)));
/* Bornes de normalisation courantes. */
DEFV(Common,DEFV(FonctionF,f____lNORMALISE_OZ(lZ)))
/* Fonction introduite le 20120323072315 par symetrie avec 'f____cNORMALISE_OZ(...)'. */
DEFV(Argument,DEFV(Int,lZ));
/* Longueur 'cZ' courante. */
/*-----------------------------------------------------------------------------------------------------------------------------------*/
Bblock
/*..............................................................................................................................*/
RETU(DENO(_____lNORMALISE_OZ(lZ)
,f____lNORMALISE_OZ_____borne_inferieure
,f____lNORMALISE_OZ_____borne_superieure
)
);
Eblock
EFonctionF
_______________________________________________________________________________________________________________________________________
_______________________________________________________________________________________________________________________________________
/*===================================================================================================================================*/
/*************************************************************************************************************************************/
/* */
/* C O M P L E M E N T A T I O N D ' U N E V A L E U R : */
/* */
/* Definition : */
/* */
/* Cette fonction 'FCOMP' est */
/* introduite en plus du "define" */
/* 'VCOMP' a cause de l'ordre des */
/* references a 'COMP', et en par- */
/* ticulier dans 'FMINMAX' (dans */
/* les fonctions de combinaison des */
/* niveaux entre eux...). */
/* */
/*************************************************************************************************************************************/
BFonctionP
DEFV(Common,DEFV(FonctionP,FCOMP(argument)))
DEFV(Argument,DEFV(genere_p,argument));
/* Argument. */
/*-----------------------------------------------------------------------------------------------------------------------------------*/
Bblock
/*..............................................................................................................................*/
RETU(VCOMP(argument));
Eblock
EFonctionP
_______________________________________________________________________________________________________________________________________
_______________________________________________________________________________________________________________________________________
/*===================================================================================================================================*/
/*************************************************************************************************************************************/
/* */
/* P A R C O U R S C I R C U L A I R E D ' U N E S P I R A L E C A R R E E : */
/* */
/* */
/* Definition : */
/* */
/* Cette fonction permet de calculer */
/* les coordonnees successives des points */
/* 'point_de_numero_cherche_relatif_au_centre' situes */
/* sur une spirale "carree" (telle que definie */
/* dans 'v $xiii/begin_end$DEF "S.P.I.R.A.L.E"') */
/* mais de facon a ce qu'ils soient obtenus dans */
/* dans le sens trigonometrique et de plus par */
/* distance croissante par rapport au centre de */
/* la spirale. Enfin, cette fonction s'inspire */
/* des programmes 'v $xtc/SpiLogCar.01$c', */
/* 'v $xtc/SpiLogCar.11$c' et 'v $xtc/SpiLogCar.12$c'. */
/* */
/* */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/* * * * ** * * * * * ** * */
/* * * * * * * * * * * * * * * * */
/* * * * * * * * * * * * * * */
/* * * * * * * * * * * * * * * * */
/* * * * * * * * * * * * * * * * */
/* * * * * * * * * * * * * * * * * * */
/* * * * * * * * * * * * * * */
/* * * * * * * * * * * * * * * * */
/* * * * * ** * * * * * ** */
/* * * * * * * * * * * * * * * * * * * * * * * */
/* */
/* */
/* ATTENTION : */
/* */
/* Il ne faut pas confondre le parcours */
/* circulaire d'une spirale carree avec, par */
/* exemple, un noyau de convolution circulaire */
/* ('v $xiii/di_image$FON 20060606125544'). */
/* */
/*************************************************************************************************************************************/
BFonctionI
#ifdef FACON_DE_PARCOURIR_CIRCULAIREMENT_UNE_SPIRALE_CARREE_VERSION_01 /* Common,DEFV(Fonction,) : avec 'VERSION_01'. */
DEFV(Common,DEFV(Logical,_____FACON_DE_PARCOURIR_CIRCULAIREMENT_UNE_SPIRALE_CARREE_VERSION_01));
#Aifdef FACON_DE_PARCOURIR_CIRCULAIREMENT_UNE_SPIRALE_CARREE_VERSION_01 /* Common,DEFV(Fonction,) : avec 'VERSION_01'. */
#Eifdef FACON_DE_PARCOURIR_CIRCULAIREMENT_UNE_SPIRALE_CARREE_VERSION_01 /* Common,DEFV(Fonction,) : avec 'VERSION_01'. */
#ifdef FACON_DE_PARCOURIR_CIRCULAIREMENT_UNE_SPIRALE_CARREE_VERSION_02 /* Common,DEFV(Fonction,) : avec 'VERSION_02'. */
DEFV(Common,DEFV(Logical,_____FACON_DE_PARCOURIR_CIRCULAIREMENT_UNE_SPIRALE_CARREE_VERSION_02));
#Aifdef FACON_DE_PARCOURIR_CIRCULAIREMENT_UNE_SPIRALE_CARREE_VERSION_02 /* Common,DEFV(Fonction,) : avec 'VERSION_02'. */
#Eifdef FACON_DE_PARCOURIR_CIRCULAIREMENT_UNE_SPIRALE_CARREE_VERSION_02 /* Common,DEFV(Fonction,) : avec 'VERSION_02'. */
#ifdef FACON_DE_PARCOURIR_CIRCULAIREMENT_UNE_SPIRALE_CARREE_VERSION_01
DenumeT05(SPIRALE_CODE_DE_REENTREE_INITIAL
,SPIRALE_CODE_DE_REENTREE_1
,SPIRALE_CODE_DE_REENTREE_2
,SPIRALE_CODE_DE_REENTREE_3
,SPIRALE_CODE_DE_REENTREE_4
,codes_de_reentree_dans_Fparcours_circulaire_d_une_spirale_carree
)
DEFV(Local,DEFV(Int,INIT(Fparcours_circulaire_d_une_spirale_carree_____code_de_reentree,UNDEF)));
/* Code de reentree dans 'Fparcours_circulaire_d_une_spirale_carree(...)' apres en etre */
/* sorti... */
DEFV(Local,DEFV(Positive,INIT(numero_du_point_courant,UNDEF)));
/* Numero du point courant. */
DEFV(Local,DEFV(Int,INIT(carre_de_la_distance_au_centre,UNDEF)));
/* Definition du carre de la distance. */
DEFV(Local,DEFV(pointI_2D,point_courant_relatif_au_centre));
/* Definition des coordonnees courantes. */
# define LE_POINT_COURANT_EST_IL_ATTEINT(code_de_reentree,condition_d_acceptation_du_point_courant,X,Y) \
Bblock \
Test(condition_d_acceptation_du_point_courant) \
Bblock \
INITIALISATION_POINT_2D(point_satisfaisant_relatif_au_centre,X,Y); \
/* Mise en place d'un point satisfaisant... */ \
EGAL(Fparcours_circulaire_d_une_spirale_carree_____code_de_reentree,SPIRALE_CODE_DE_REENTREE_INITIAL); \
/* A priori, mise en place du code de reentree 'INITIAL'... */ \
\
Test(IFEQ(numero_du_point_courant,numero_du_point_courant_utilise)) \
Bblock \
EGAL(iterer,FAUX); \
/* Dans le cas ou le point satisfaisant est le point cherche, on s'arrete, */ \
EGAL(Fparcours_circulaire_d_une_spirale_carree_____code_de_reentree,code_de_reentree); \
/* Et on memorise l'emplacement du 'LE_POINT_COURANT_EST_IL_ATTEINT(...)' correspondant */ \
/* dans 'Fparcours_circulaire_d_une_spirale_carree(...)'. */ \
Eblock \
ATes \
Bblock \
Eblock \
ETes \
\
INCR(numero_du_point_courant,I); \
/* Comptage des points satisfaisants... */ \
Eblock \
ATes \
Bblock \
Eblock \
ETes \
Eblock \
/* Procedure testant si le point cherche est atteint. */
#Aifdef FACON_DE_PARCOURIR_CIRCULAIREMENT_UNE_SPIRALE_CARREE_VERSION_01
#Eifdef FACON_DE_PARCOURIR_CIRCULAIREMENT_UNE_SPIRALE_CARREE_VERSION_01
#ifdef FACON_DE_PARCOURIR_CIRCULAIREMENT_UNE_SPIRALE_CARREE_VERSION_02
DEFV(Common,DEFV(Logical,ZINT(Fparcours_circulaire_d_une_spirale_carree_____compatibilite_2014082117,FAUX)));
/* Introduit le 20140821171340 afin de permettre de retablir le comportement anterieur */
DEFV(Local,DEFV(Positive,INIT(une_initialisation_de_la_spirale_a_ete_faite,FAUX)));
/* Afin de valider les requetes apres une initialisation... */
DEFV(Local,DEFV(Positive,INIT(nombre_de_points_de_la_spirale_initialisee,UNDEF)));
/* Afin de valider les requetes apres une initialisation... */
DEFV(pointI_2D,DdTb1(POINTERs
,liste_des_points_de_la_spirale
,UNDEF
,ADRESSE_NON_ENCORE_DEFINIE
)
);
/* Liste des points de la spirale... */
# define PREMIER_POINT_DE_LA_SPIRALE \
PREMIER_POINT
# define DERNIER_POINT_DE_LA_SPIRALE \
Fparcours_circulaire_d_une_spirale_carree_____numero_du_dernier_point
/* Introduits le 20141125091220... */
# define ACCES_AUX_POINTS_DE_LA_SPIRALE(numero) \
IdTb1(liste_des_points_de_la_spirale \
,INDX(numero,PREMIER_POINT_DE_LA_SPIRALE) \
,nombre_de_points_de_la_spirale_initialisee \
) \
/* Procedure d'acces aux points de la spirale... */
DEFV(Common,DEFV(Positive,INIT(Fparcours_circulaire_d_une_spirale_carree_____numero_du_dernier_point,PREMIER_POINT_DE_LA_SPIRALE)));
/* Numero du dernier point de la spirale (introduit le 20141124184050). */
# define LE_POINT_COURANT_EST_IL_ATTEINT(condition_d_acceptation_du_point_courant,X,Y) \
Bblock \
Test(IFLE(numero_du_point_courant \
,LSTX(PREMIER_POINT_DE_LA_SPIRALE,nombre_de_points_de_la_spirale_initialisee) \
) \
) \
Bblock \
Test(condition_d_acceptation_du_point_courant) \
Bblock \
INITIALISATION_POINT_2D(ACCES_AUX_POINTS_DE_LA_SPIRALE(numero_du_point_courant),X,Y); \
/* Mise en place d'un point satisfaisant... */ \
\
EGAL(DERNIER_POINT_DE_LA_SPIRALE \
,numero_du_point_courant \
); \
/* Afin de memoriser le numero du dernier point (introduit le 20141124184050). */ \
\
INCR(numero_du_point_courant,I); \
/* Comptage des points satisfaisants... */ \
Eblock \
ATes \
Bblock \
Eblock \
ETes \
Eblock \
ATes \
Bblock \
PRINT_ERREUR("trop de points sont ranges dans la spirale courante"); \
CAL1(Prer1("nombre maximal de points=%d\n",nombre_de_points_de_la_spirale_initialisee)); \
CAL1(Prer1("numero du point courant =%d\n",numero_du_point_courant)); \
Eblock \
ETes \
Eblock \
/* Procedure testant si le point cherche est atteint. */
#Aifdef FACON_DE_PARCOURIR_CIRCULAIREMENT_UNE_SPIRALE_CARREE_VERSION_02
#Eifdef FACON_DE_PARCOURIR_CIRCULAIREMENT_UNE_SPIRALE_CARREE_VERSION_02
DEFV(Common,DEFV(FonctionI,Fparcours_circulaire_d_une_spirale_carree(point_de_numero_cherche_relatif_au_centre
,numero_du_point_courant_cherche
,valeur_maximale_de_X_et_de_Y_relatifs
,initialiser_le_processus
,desinitialiser_le_processus
)
)
)
DEFV(Argument,DEFV(pointI_2D,POINTERs(point_de_numero_cherche_relatif_au_centre)));
/* Definition du couple {x,y} anterieur... */
DEFV(Argument,DEFV(Positive,numero_du_point_courant_cherche));
/* Numero du point courant recherche. */
DEFV(Argument,DEFV(Int,valeur_maximale_de_X_et_de_Y_relatifs));
/* Valeur maximale commune a 'X' et a 'Y' (puisque la spirale est carree...). */
DEFV(Argument,DEFV(Logical,initialiser_le_processus));
/* Indicateur d'initialisation a faire. */
DEFV(Argument,DEFV(Logical,desinitialiser_le_processus));
/* Indicateur de desinitialisation a faire. ATTENTION, cet indicateur n'a pas de sens en */
/* 'FACON_DE_PARCOURIR_CIRCULAIREMENT_UNE_SPIRALE_CARREE_VERSION_01' mais est mis malgre */
/* tout pour simplifier... */
/*-----------------------------------------------------------------------------------------------------------------------------------*/
Bblock
INIT_ERROR;
/* ATTENTION : 'INIT_ERROR' est mis en tete des variables locales au cas ou des couples */
/* ('BDEFV','EDEFV') suivraient... */
DEFV(Positive,INIT(numero_du_point_courant_utilise,numero_du_point_courant_cherche));
/* Numero du point reellement utilise... */
#ifdef FACON_DE_PARCOURIR_CIRCULAIREMENT_UNE_SPIRALE_CARREE_VERSION_01
DEFV(Logical,INIT(iterer,VRAI));
/* Pour controler la boucle 'Tant(...)'. */
DEFV(pointI_2D,point_satisfaisant_relatif_au_centre);
/* Definition des coordonnees courantes d'un point satisfaisant. */
#Aifdef FACON_DE_PARCOURIR_CIRCULAIREMENT_UNE_SPIRALE_CARREE_VERSION_01
#Eifdef FACON_DE_PARCOURIR_CIRCULAIREMENT_UNE_SPIRALE_CARREE_VERSION_01
#ifdef FACON_DE_PARCOURIR_CIRCULAIREMENT_UNE_SPIRALE_CARREE_VERSION_02
DEFV(Positive,INIT(nombre_de_points_de_la_spirale_courante
,NBRE(PREMIER_POINT_DE_LA_SPIRALE
,DERNIER_POINT_D_UNE_SPIRALE_CIRCULAIRE(valeur_maximale_de_X_et_de_Y_relatifs)
)
)
);
/* Afin de valider les requetes apres une initialisation... */
DEFV(Positive,INIT(numero_du_point_courant,PREMIER_POINT_DE_LA_SPIRALE));
/* Numero du point courant initialise sur le premier point de la liste... */
DEFV(Int,INIT(carre_de_la_distance_au_centre,UNDEF));
/* Definition du carre de la distance. */
#Aifdef FACON_DE_PARCOURIR_CIRCULAIREMENT_UNE_SPIRALE_CARREE_VERSION_02
#Eifdef FACON_DE_PARCOURIR_CIRCULAIREMENT_UNE_SPIRALE_CARREE_VERSION_02
/*..............................................................................................................................*/
Test(IFEXff(numero_du_point_courant_utilise
,PREMIER_POINT_DE_LA_SPIRALE
,DERNIER_POINT_D_UNE_SPIRALE_CIRCULAIRE(valeur_maximale_de_X_et_de_Y_relatifs)
)
)
Bblock
PRINT_ERREUR("le numero du point courant est hors limite (1)");
#ifdef FACON_DE_PARCOURIR_CIRCULAIREMENT_UNE_SPIRALE_CARREE_VERSION_01
PRINT_ERREUR("le processus va malheureusement entrer dans une boucle infinie");
#Aifdef FACON_DE_PARCOURIR_CIRCULAIREMENT_UNE_SPIRALE_CARREE_VERSION_01
#Eifdef FACON_DE_PARCOURIR_CIRCULAIREMENT_UNE_SPIRALE_CARREE_VERSION_01
#ifdef FACON_DE_PARCOURIR_CIRCULAIREMENT_UNE_SPIRALE_CARREE_VERSION_02
PRINT_ERREUR("on va utiliser le dernier point possible");
EGAL(numero_du_point_courant_utilise,DERNIER_POINT_D_UNE_SPIRALE_CIRCULAIRE(valeur_maximale_de_X_et_de_Y_relatifs));
#Aifdef FACON_DE_PARCOURIR_CIRCULAIREMENT_UNE_SPIRALE_CARREE_VERSION_02
#Eifdef FACON_DE_PARCOURIR_CIRCULAIREMENT_UNE_SPIRALE_CARREE_VERSION_02
CAL1(Prer1("numero demande=%d\n",numero_du_point_courant_utilise));
CAL1(Prer1("borne inferieure=%d\n",PREMIER_POINT_DE_LA_SPIRALE));
CAL1(Prer1("borne superieure=%d\n",DERNIER_POINT_D_UNE_SPIRALE_CIRCULAIRE(valeur_maximale_de_X_et_de_Y_relatifs)));
Eblock
ATes
Bblock
Eblock
ETes
#ifdef FACON_DE_PARCOURIR_CIRCULAIREMENT_UNE_SPIRALE_CARREE_VERSION_01
Test(IL_FAUT(initialiser_le_processus))
Bblock
/* Cas ou l'initialisation est necessaire : */
EGAL(numero_du_point_courant,PREMIER_POINT_DE_LA_SPIRALE);
/* Numero du premier point... */
INITIALISATION_POINT_2D(point_courant_relatif_au_centre,Xmin,Ymin);
EGAL(carre_de_la_distance_au_centre
,disI2D(Xmin,Ymin,ASD1(point_courant_relatif_au_centre,x),ASD1(point_courant_relatif_au_centre,y))
);
/* Initialisation du point relatif au centre de la spirale courant. */
EGAL(Fparcours_circulaire_d_une_spirale_carree_____code_de_reentree,SPIRALE_CODE_DE_REENTREE_INITIAL);
Eblock
ATes
Bblock
/* Cas ou l'initialisation a deja ete faite... */
Eblock
ETes
#Aifdef FACON_DE_PARCOURIR_CIRCULAIREMENT_UNE_SPIRALE_CARREE_VERSION_01
#Eifdef FACON_DE_PARCOURIR_CIRCULAIREMENT_UNE_SPIRALE_CARREE_VERSION_01
#ifdef FACON_DE_PARCOURIR_CIRCULAIREMENT_UNE_SPIRALE_CARREE_VERSION_02
Test(IL_FAUT(initialiser_le_processus))
Bblock
/* Cas ou l'initialisation est demandee : */
Test(EST_VRAI(une_initialisation_de_la_spirale_a_ete_faite))
Bblock
/* Cas ou une initialisation a deja ete faite : */
Test(IFNE(nombre_de_points_de_la_spirale_initialisee,nombre_de_points_de_la_spirale_courante))
Bblock
FdTb1(liste_des_points_de_la_spirale
,nombre_de_points_de_la_spirale_initialisee
,pointI_2D
,ADRESSE_NON_ENCORE_DEFINIE
);
/* Lorsque l'ancienne spirale et la nouvelle ne sont pas identiques, on rend l'espace */
/* alloue a l'ancienne, */
/* */
/* Le 'ADRESSE_NON_ENCORE_DEFINIE' a ete introduit le 20050221165319... */
EGAL(une_initialisation_de_la_spirale_a_ete_faite,FAUX);
/* Puis on force une initialisation de facon a creer la nouvelle... */
Eblock
ATes
Bblock
/* Cas ou l'ancienne spirale et la nouvelle sont identiques, il est alors inutile de */
/* reinitialiser... */
Eblock
ETes
Eblock
ATes
Bblock
/* Cas ou il n'y a pas d'initialisation anterieure a celle qui est demandee ici... */
Eblock
ETes
/* ATTENTION, il est impossible de reunir les deux tests : */
/* */
/* Test(EST_VRAI(une_initialisation_de_la_spirale_a_ete_faite)) */
/* */
/* (qui precede) */
/* */
/* Test(EST_FAUX(une_initialisation_de_la_spirale_a_ete_faite)) */
/* */
/* (qui suit) a cause de la modification apportee eventuellement ci-dessus a l'indicateur */
/* 'une_initialisation_de_la_spirale_a_ete_faite'... */
Test(EST_FAUX(une_initialisation_de_la_spirale_a_ete_faite))
Bblock
/* Cas ou l'initialisation est necessaire : */
EGAL(nombre_de_points_de_la_spirale_initialisee,nombre_de_points_de_la_spirale_courante);
/* Nombre de points de la spirale a allouer... */
MdTb1(liste_des_points_de_la_spirale
,nombre_de_points_de_la_spirale_initialisee
,pointI_2D
,ADRESSE_NON_ENCORE_DEFINIE
);
/* Allocation de la memoire, qui ne sera jamais rendue malheureusement... */
DoIn(carre_de_la_distance_au_centre
,disI2D(Xmin,Ymin,Xmin,Ymin)
,COND(IL_FAUT(Fparcours_circulaire_d_une_spirale_carree_____compatibilite_2014082117)
,disI2D(Xmin,Ymin,valeur_maximale_de_X_et_de_Y_relatifs,valeur_maximale_de_X_et_de_Y_relatifs)
,CHOI(disI2D(Xmin,Ymin,valeur_maximale_de_X_et_de_Y_relatifs,Ymin)
,disI2D(Xmin,Ymin,Xmin,valeur_maximale_de_X_et_de_Y_relatifs)
)
)
,I
)
/* Ainsi, on parcourt toutes les distances possibles a l'interieur du cercle utile... */
/* Une erreur grossiere a ete corrigee le 20140821171340 : avant cette date, on utilisait */
/* la demi-diagonale du carre circonscrit et non pas son demi-cote... */
Bblock
begin_imageQ(DoIn
,Ymin,valeur_maximale_de_X_et_de_Y_relatifs,pasY
,DoIn
,Xmin,valeur_maximale_de_X_et_de_Y_relatifs,pasX
)
Bblock
Test(IFEQ(disI2D(Xmin,Ymin,X,Y),carre_de_la_distance_au_centre))
Bblock
LE_POINT_COURANT_EST_IL_ATTEINT(TOUJOURS_VRAI
,NEUT(X)
,NEUT(Y)
);
/* Test du point {X,Y} dans le premier quadrant (de la spirale). */
LE_POINT_COURANT_EST_IL_ATTEINT(IFNE(X,Xmin)
,COXA(SOUS(Xmin,X))
,NEUT(Y)
);
/* Test du point {Xmin-X,Y} dans le deuxieme quadrant (de la spirale). */
LE_POINT_COURANT_EST_IL_ATTEINT(IFET(IFNE(X,Xmin)
,IFNE(Y,Ymin)
)
,COXA(SOUS(Xmin,X))
,COYA(SOUS(Ymin,Y))
);
/* Test du point {Xmin-X,Ymin-Y} dans le troisieme quadrant (de la spirale). */
LE_POINT_COURANT_EST_IL_ATTEINT(IFNE(Y,Ymin)
,NEUT(X)
,COYA(SOUS(Ymin,Y))
);
/* Test du point {X,Ymin-Y} dans le quatrieme quadrant (de la spirale). */
Eblock
ATes
Bblock
Eblock
ETes
Eblock
end_imageQ(EDoI,EDoI)
Eblock
EDoI
EGAL(une_initialisation_de_la_spirale_a_ete_faite,VRAI);
/* Afin de savoir qu'au moins une initialisation a ete faite... */
Eblock
ATes
Bblock
/* Cas ou l'initialisation a deja ete faite... */
Eblock
ETes
Eblock
ATes
Bblock
/* Cas ou l'initialisation n'est pas demandee... */
Test(IL_NE_FAUT_PAS(desinitialiser_le_processus))
Bblock
Test(IFEXff(numero_du_point_courant_utilise
,PREMIER_POINT_DE_LA_SPIRALE
,DERNIER_POINT_DE_LA_SPIRALE
)
)
/* Test introduit le 20141125091220... */
Bblock
PRINT_ERREUR("le numero du point courant est hors limite (2)");
CAL1(Prer1("numero demande=%d\n",numero_du_point_courant_utilise));
CAL1(Prer1("borne inferieure=%d\n",PREMIER_POINT_DE_LA_SPIRALE));
CAL1(Prer1("borne superieure=%d\n",DERNIER_POINT_DE_LA_SPIRALE));
Eblock
ATes
Bblock
Eblock
ETes
Eblock
ATes
Bblock
Eblock
ETes
Eblock
ETes
#Aifdef FACON_DE_PARCOURIR_CIRCULAIREMENT_UNE_SPIRALE_CARREE_VERSION_02
#Eifdef FACON_DE_PARCOURIR_CIRCULAIREMENT_UNE_SPIRALE_CARREE_VERSION_02
#ifdef FACON_DE_PARCOURIR_CIRCULAIREMENT_UNE_SPIRALE_CARREE_VERSION_01
Tant(IL_FAUT(iterer))
Bblock
Test(IFET(IFEQ(disI2D(Xmin,Ymin,ASD1(point_courant_relatif_au_centre,x),ASD1(point_courant_relatif_au_centre,y))
,carre_de_la_distance_au_centre
)
,IFET(IFLE(ASD1(point_courant_relatif_au_centre,x),valeur_maximale_de_X_et_de_Y_relatifs)
,IFLE(ASD1(point_courant_relatif_au_centre,y),valeur_maximale_de_X_et_de_Y_relatifs)
)
)
)
Bblock
/* Cas ou le point courant 'point_courant_relatif_au_centre' est a la bonne distance du */
/* centre de la spirale (voir 'carre_de_la_distance_au_centre'), tout en etant sur la */
/* spirale (voir 'valeur_maximale_de_X_et_de_Y_relatifs'). Soit {X,Y} ce point... */
/* */
/* On trouvera ci-apres une spirale ou les points sont marques a l'aide du carre de la */
/* distance au centre de la spirale '0' : */
/* */
/* */
/* 8 5 4 5 8 */
/* / \ */
/* / \ */
/* 5 2 1 2 5 */
/* / \ */
/* / \ */
/* 4 1 0 1 4 */
/* \ / */
/* \ / */
/* 5 2 1 2 5 */
/* \ / */
/* \ / */
/* 8 5 4 5 8 */
/* */
/* */
/* l'ordre etant donne par le programme 'v $xtc/SpiLogCar.01$c'. */
LE_POINT_COURANT_EST_IL_ATTEINT(SPIRALE_CODE_DE_REENTREE_1
,IFET(IFOU(IFEQ(Fparcours_circulaire_d_une_spirale_carree_____code_de_reentree
,SPIRALE_CODE_DE_REENTREE_INITIAL
)
,IFEQ(Fparcours_circulaire_d_une_spirale_carree_____code_de_reentree
,SPIRALE_CODE_DE_REENTREE_4
)
)
,IL_FAUT(iterer)
)
,ASD1(point_courant_relatif_au_centre,x)
,ASD1(point_courant_relatif_au_centre,y)
);
/* Test du point {X,Y} dans le premier quadrant (de la spirale). */
LE_POINT_COURANT_EST_IL_ATTEINT(SPIRALE_CODE_DE_REENTREE_2
,IFET(IFOU(IFEQ(Fparcours_circulaire_d_une_spirale_carree_____code_de_reentree
,SPIRALE_CODE_DE_REENTREE_INITIAL
)
,IFLE(Fparcours_circulaire_d_une_spirale_carree_____code_de_reentree
,SPIRALE_CODE_DE_REENTREE_1
)
)
,IFET(IL_FAUT(iterer)
,IFNE(ASD1(point_courant_relatif_au_centre,x),Xmin)
)
)
,COXA(SOUS(Xmin,ASD1(point_courant_relatif_au_centre,x)))
,ASD1(point_courant_relatif_au_centre,y)
);
/* Test du point {Xmin-X,Y} dans le deuxieme quadrant (de la spirale). */
LE_POINT_COURANT_EST_IL_ATTEINT(SPIRALE_CODE_DE_REENTREE_3
,IFET(IFOU(IFEQ(Fparcours_circulaire_d_une_spirale_carree_____code_de_reentree
,SPIRALE_CODE_DE_REENTREE_INITIAL
)
,IFLE(Fparcours_circulaire_d_une_spirale_carree_____code_de_reentree
,SPIRALE_CODE_DE_REENTREE_2
)
)
,IFET(IL_FAUT(iterer)
,IFET(IFNE(ASD1(point_courant_relatif_au_centre,x),Xmin)
,IFNE(ASD1(point_courant_relatif_au_centre,y),Ymin)
)
)
)
,COXA(SOUS(Xmin,ASD1(point_courant_relatif_au_centre,x)))
,COYA(SOUS(Ymin,ASD1(point_courant_relatif_au_centre,y)))
);
/* Test du point {Xmin-X,Ymin-Y} dans le troisieme quadrant (de la spirale). */
LE_POINT_COURANT_EST_IL_ATTEINT(SPIRALE_CODE_DE_REENTREE_4
,IFET(IFOU(IFEQ(Fparcours_circulaire_d_une_spirale_carree_____code_de_reentree
,SPIRALE_CODE_DE_REENTREE_INITIAL
)
,IFLE(Fparcours_circulaire_d_une_spirale_carree_____code_de_reentree
,SPIRALE_CODE_DE_REENTREE_3
)
)
,IFET(IL_FAUT(iterer)
,IFNE(ASD1(point_courant_relatif_au_centre,y),Ymin)
)
)
,ASD1(point_courant_relatif_au_centre,x)
,COYA(SOUS(Ymin,ASD1(point_courant_relatif_au_centre,y)))
);
/* Test du point {X,Ymin-Y} dans le quatrieme quadrant (de la spirale). */
Eblock
ATes
Bblock
Eblock
ETes
Test(IFOU(IL_FAUT(iterer)
,IFET(IL_NE_FAUT_PAS(iterer)
,IFEQ(Fparcours_circulaire_d_une_spirale_carree_____code_de_reentree,SPIRALE_CODE_DE_REENTREE_4)
)
)
)
Bblock
/* Cas ou il faut modifier {X,Y} : */
/* */
/* On notera que le parcours se fait en modifiant dans l'ordre : */
/* */
/* X, */
/* Y, */
/* carre_de_la_distance_au_centre, */
/* */
/* ce qui, avec la gestion de 'LE_POINT_COURANT_EST_IL_ATTEINT(...)' donne un ordre de */
/* parcours peu satisfaisant : */
/* */
/* */
/* 23 19 12 18 22 */
/* */
/* */
/* 15 07 04 06 14 */
/* */
/* */
/* 11 03 01 02 10 */
/* */
/* */
/* 16 08 05 09 17 */
/* */
/* */
/* 24 20 13 21 25 */
/* */
/* */
EGAL(Fparcours_circulaire_d_une_spirale_carree_____code_de_reentree,SPIRALE_CODE_DE_REENTREE_INITIAL);
INCR(ASD1(point_courant_relatif_au_centre,x),pasX);
/* Progression de 'X'. */
Test(IFGT(ASD1(point_courant_relatif_au_centre,x),valeur_maximale_de_X_et_de_Y_relatifs))
Bblock
EGAL(ASD1(point_courant_relatif_au_centre,x),Xmin);
INCR(ASD1(point_courant_relatif_au_centre,y),pasY);
/* Progression de 'Y' et reinitialisation de 'X'. */
Test(IFGT(ASD1(point_courant_relatif_au_centre,y),valeur_maximale_de_X_et_de_Y_relatifs))
Bblock
EGAL(ASD1(point_courant_relatif_au_centre,y),Ymin);
INCR(carre_de_la_distance_au_centre,I);
/* Progression de la longueur courante et reinitialisation de 'Y'. */
Eblock
ATes
Bblock
Eblock
ETes
Eblock
ATes
Bblock
Eblock
ETes
Eblock
ATes
Bblock
Eblock
ETes
Eblock
ETan
TRANSFERT_POINT_2D(PINDIRECT(point_de_numero_cherche_relatif_au_centre),point_satisfaisant_relatif_au_centre);
/* Renvoi du point recherche... */
#Aifdef FACON_DE_PARCOURIR_CIRCULAIREMENT_UNE_SPIRALE_CARREE_VERSION_01
#Eifdef FACON_DE_PARCOURIR_CIRCULAIREMENT_UNE_SPIRALE_CARREE_VERSION_01
#ifdef FACON_DE_PARCOURIR_CIRCULAIREMENT_UNE_SPIRALE_CARREE_VERSION_02
Test(EST_VRAI(une_initialisation_de_la_spirale_a_ete_faite))
Bblock
Test(IL_NE_FAUT_PAS(desinitialiser_le_processus))
Bblock
/* Cas des acces a la spirale... */
Test(IFEQ(nombre_de_points_de_la_spirale_courante,nombre_de_points_de_la_spirale_initialisee))
Bblock
TRANSFERT_POINT_2D(PINDIRECT(point_de_numero_cherche_relatif_au_centre)
,ACCES_AUX_POINTS_DE_LA_SPIRALE(numero_du_point_courant_cherche)
);
/* Renvoi du point recherche... */
Eblock
ATes
Bblock
PRINT_ERREUR("une spirale est accedee au dela de ce qui a ete alloue, on renvoie l'origine");
INITIALISATION_POINT_2D(PINDIRECT(point_de_numero_cherche_relatif_au_centre),Xmin,Ymin);
Eblock
ETes
Eblock
ATes
Bblock
FdTb1(liste_des_points_de_la_spirale
,nombre_de_points_de_la_spirale_initialisee
,pointI_2D
,ADRESSE_NON_ENCORE_DEFINIE
);
/* Lorsque la desinitialisation est demandee, on rend l'espace de la spirale. */
/* */
/* Le 'ADRESSE_NON_ENCORE_DEFINIE' a ete introduit le 20050221165319... */
EGAL(nombre_de_points_de_la_spirale_initialisee,UNDEF);
EGAL(une_initialisation_de_la_spirale_a_ete_faite,FAUX);
/* Et enfin, on memorise qu'il n'y a plus de spirale... */
Eblock
ETes
Eblock
ATes
Bblock
PRINT_ERREUR("une spirale non initialisee est utilisee, on renvoie l'origine");
INITIALISATION_POINT_2D(PINDIRECT(point_de_numero_cherche_relatif_au_centre),Xmin,Ymin);
Eblock
ETes
#Aifdef FACON_DE_PARCOURIR_CIRCULAIREMENT_UNE_SPIRALE_CARREE_VERSION_02
#Eifdef FACON_DE_PARCOURIR_CIRCULAIREMENT_UNE_SPIRALE_CARREE_VERSION_02
RETU_ERROR;
Eblock
#ifdef FACON_DE_PARCOURIR_CIRCULAIREMENT_UNE_SPIRALE_CARREE_VERSION_01
# undef LE_POINT_COURANT_EST_IL_ATTEINT
#Aifdef FACON_DE_PARCOURIR_CIRCULAIREMENT_UNE_SPIRALE_CARREE_VERSION_01
#Eifdef FACON_DE_PARCOURIR_CIRCULAIREMENT_UNE_SPIRALE_CARREE_VERSION_01
#ifdef FACON_DE_PARCOURIR_CIRCULAIREMENT_UNE_SPIRALE_CARREE_VERSION_02
# undef DERNIER_POINT_DE_LA_SPIRALE
# undef PREMIER_POINT_DE_LA_SPIRALE
# undef ACCES_AUX_POINTS_DE_LA_SPIRALE
# undef LE_POINT_COURANT_EST_IL_ATTEINT
#Aifdef FACON_DE_PARCOURIR_CIRCULAIREMENT_UNE_SPIRALE_CARREE_VERSION_02
#Eifdef FACON_DE_PARCOURIR_CIRCULAIREMENT_UNE_SPIRALE_CARREE_VERSION_02
EFonctionI
_______________________________________________________________________________________________________________________________________
_______________________________________________________________________________________________________________________________________
/*===================================================================================================================================*/
/*************************************************************************************************************************************/
/* */
/* P A R C O U R S A L A " P E A N O " D ' U N E I M A G E : */
/* */
/*************************************************************************************************************************************/
BFonctionI
#define IPeano(v1,v2) \
INTE(MOYS(v2,v1)) \
/* Pour se placer au milieu du segment [v1,v2]. */
#define M2Peano(v1,v2) \
ADD2(v1,IPeano(v1,v2)) \
/* Pour determiner les points du type 'point*2' et 'point2*' sur le segment [v1,v2]. */
#define M3Peano(v1,v2) \
SOUS(v2,IPeano(v1,v2)) \
/* Pour determiner les points du type 'point*3' et 'point3*' sur le segment [v1,v2]. */
#define SPeano(point,Cx,Cy) \
Bblock \
INITIALISATION_POINT_2D(point,Cx,Cy); \
Eblock \
/* Initialisation de l'un des points d'un "cadre". */
DEFV(Common,DEFV(FonctionI,FPeano(ARGUMENT_POINTERs(point1)
,ARGUMENT_POINTERs(point2)
,ARGUMENT_POINTERs(point3)
,ARGUMENT_POINTERs(point4)
,emission_des_coordonnees
,ARGUMENT_FACULTATIF(ARGUMENT_POINTERs(processus_recepteur))
)
)
)
DEFV(Argument,DEFV(pointI_2D,POINTERs(point1)));
DEFV(Argument,DEFV(pointI_2D,POINTERs(point2)));
DEFV(Argument,DEFV(pointI_2D,POINTERs(point3)));
DEFV(Argument,DEFV(pointI_2D,POINTERs(point4)));
/* Definition des quatres coins donnant l'ordre dans lequel on parcours le "cadre" courant : */
/* */
/* 2-----------------------------3 */
/* | | */
/* | | */
/* | | */
/* | | */
/* | | */
/* | | */
/* | | */
/* ^ | */
/* | | */
/* | | */
/* | | */
/* | | */
/* | | */
/* | | */
/* 1 4 */
/* */
DEFV(Argument,DEFV(Logical,emission_des_coordonnees));
/* Indique si les coordonnees doivent etre transmises ('VRAI') ou pas ('FAUX') au */
/* 'processus_recepteur'. */
DEFV(Argument,DEFV(processus,POINTERs(processus_recepteur)));
/* Description du processus auquel transmettre les coordonnees dans [Xmin,Xmax]x[Ymin,Ymax] */
/* des coordonnees extraites recursivement... */
/*-----------------------------------------------------------------------------------------------------------------------------------*/
Bblock
INIT_ERROR;
DEFV(pointI_2D,point11);
DEFV(pointI_2D,point12);
DEFV(pointI_2D,point13);
DEFV(pointI_2D,point14);
DEFV(pointI_2D,point21);
DEFV(pointI_2D,point22);
DEFV(pointI_2D,point23);
DEFV(pointI_2D,point24);
DEFV(pointI_2D,point31);
DEFV(pointI_2D,point32);
DEFV(pointI_2D,point33);
DEFV(pointI_2D,point34);
DEFV(pointI_2D,point41);
DEFV(pointI_2D,point42);
DEFV(pointI_2D,point43);
DEFV(pointI_2D,point44);
/* Definition de la subdivision recursive du "cadre" courant : */
/* */
/* 41-----------42 43-----------44 */
/* | | | | */
/* | | | | */
/* | | | | */
/* ^ | ^ | */
/* | | | | */
/* | | | | */
/* 31 32 33 34 */
/* */
/* 21-----------22 23-----<-----24 */
/* | | */
/* | | */
/* | | */
/* | | */
/* | | */
/* | | */
/* 11----->-----12 13-----------14 */
/* */
/* On notera que si l'on ne conserve que le premier point de chaque "sous-cadre" (a */
/* savoir '11', '31', '33' puis enfin '24') le "remplissage" du plan obtenu n'est pas */
/* regulier (en particulier '24' est tres different des autres...). */
/* */
/* */
/* Decoupage recursif de [a,b] : */
/* b * */
/* / */
/* / */
/* / */
/* / */
/* + <-- (b - IPeano(a,b)) */
/* + <-- (a + IPeano(a,b)) */
/* / */
/* / */
/* / */
/* / */
/* a * */
/* */
/* */
/*..............................................................................................................................*/
Test(IFOU(IFGE(SOUA(CHOI(ASI1(point4,x),ASI1(point3,x)),CHOI(ASI1(point1,x),ASI1(point2,x))),pasX)
,IFGE(SOUA(CHOI(ASI1(point4,y),ASI1(point3,y)),CHOI(ASI1(point1,y),ASI1(point2,y))),pasY)
)
)
Bblock
SPeano(point11,ASI1(point1,x),ASI1(point1,y));
SPeano(point41,ASI1(point2,x),ASI1(point2,y));
SPeano(point44,ASI1(point3,x),ASI1(point3,y));
SPeano(point14,ASI1(point4,x),ASI1(point4,y));
/* Determination des 4 sommets principaux. */
SPeano(point12,M2Peano(ASD1(point11,x),ASD1(point14,x)),M2Peano(ASD1(point11,y),ASD1(point14,y)));
SPeano(point13,M3Peano(ASD1(point11,x),ASD1(point14,x)),M3Peano(ASD1(point11,y),ASD1(point14,y)));
SPeano(point42,M2Peano(ASD1(point41,x),ASD1(point44,x)),M2Peano(ASD1(point41,y),ASD1(point44,y)));
SPeano(point43,M3Peano(ASD1(point41,x),ASD1(point44,x)),M3Peano(ASD1(point41,y),ASD1(point44,y)));
SPeano(point21,M2Peano(ASD1(point11,x),ASD1(point41,x)),M2Peano(ASD1(point11,y),ASD1(point41,y)));
SPeano(point31,M3Peano(ASD1(point11,x),ASD1(point41,x)),M3Peano(ASD1(point11,y),ASD1(point41,y)));
SPeano(point24,M2Peano(ASD1(point14,x),ASD1(point44,x)),M2Peano(ASD1(point14,y),ASD1(point44,y)));
SPeano(point34,M3Peano(ASD1(point14,x),ASD1(point44,x)),M3Peano(ASD1(point14,y),ASD1(point44,y)));
/* Determination des 8 milieux des cotes. */
SPeano(point22
,CHOI(M2Peano(ASD1(point21,x),ASD1(point24,x))
,M2Peano(ASD1(point12,x),ASD1(point42,x))
)
,CHOI(M2Peano(ASD1(point21,y),ASD1(point24,y))
,M2Peano(ASD1(point12,y),ASD1(point42,y))
)
);
SPeano(point23
,CHOI(M3Peano(ASD1(point21,x),ASD1(point24,x))
,M2Peano(ASD1(point13,x),ASD1(point43,x))
)
,CHOI(M3Peano(ASD1(point21,y),ASD1(point24,y))
,M2Peano(ASD1(point13,y),ASD1(point43,y))
)
);
SPeano(point32
,CHOI(M2Peano(ASD1(point31,x),ASD1(point34,x))
,M3Peano(ASD1(point12,x),ASD1(point42,x))
)
,CHOI(M2Peano(ASD1(point31,y),ASD1(point34,y))
,M3Peano(ASD1(point12,y),ASD1(point42,y))
)
);
SPeano(point33
,CHOI(M3Peano(ASD1(point31,x),ASD1(point34,x))
,M3Peano(ASD1(point13,x),ASD1(point43,x))
)
,CHOI(M3Peano(ASD1(point31,y),ASD1(point34,y))
,M3Peano(ASD1(point13,y),ASD1(point43,y))
)
);
/* Determination des 4 centres du "cadre" initial. */
CALS(FPeano(ADRESSE(point11),ADRESSE(point12),ADRESSE(point22),ADRESSE(point21)
,emission_des_coordonnees,processus_recepteur
)
);
CALS(FPeano(ADRESSE(point31),ADRESSE(point41),ADRESSE(point42),ADRESSE(point32)
,emission_des_coordonnees,processus_recepteur
)
);
CALS(FPeano(ADRESSE(point33),ADRESSE(point43),ADRESSE(point44),ADRESSE(point34)
,emission_des_coordonnees,processus_recepteur
)
);
CALS(FPeano(ADRESSE(point24),ADRESSE(point23),ADRESSE(point13),ADRESSE(point14)
,emission_des_coordonnees,processus_recepteur
)
);
/* Et enfin, subdivision recursive en 4 "sous-cadres" non reduits a un seul point. */
Eblock
ATes
Bblock
Test(IL_FAUT(emission_des_coordonnees))
Bblock
SEND_I(INDIRECT(processus_recepteur),ASI1(point1,x));
SEND_I(INDIRECT(processus_recepteur),ASI1(point1,y));
/* Et ainsi, on envoie a un processus interesse, les coordonnees du premier point 'point1' */
/* du "cadre" courant, dans l'ordre 'x' puis 'y'... */
Eblock
ATes
Bblock
CAL3(Prme2("(%d,%d)\n",ASI1(point1,x),ASI1(point1,y)));
/* Sinon, on edite les coordonnees {x,y}... */
Eblock
ETes
Eblock
ETes
RETU_ERROR;
Eblock
#undef SPeano
#undef M3Peano
#undef M2Peano
#undef IPeano
EFonctionI
_______________________________________________________________________________________________________________________________________