/*************************************************************************************************************************************/
/* */
/* T E S T D U C A L C U L D E S C O O R D O N N E E S D E S P O I N T S D ' U N E S P I R A L E : */
/* */
/* */
/* Author of '$xtKi/spirale.01$K' : */
/* */
/* Jean-Francois COLONNA (LACTAMME, 1992??????????). */
/* */
/*************************************************************************************************************************************/
/*===================================================================================================================================*/
/*************************************************************************************************************************************/
/* */
/* F I C H I E R S D ' I N C L U D E S : */
/* */
/*************************************************************************************************************************************/
#include INCLUDES_BASE
/*===================================================================================================================================*/
/*************************************************************************************************************************************/
/* */
/* P A R A M E T R E S : */
/* */
/*************************************************************************************************************************************/
#define NOMBRE_DE_POINTS_A_SAUTER_SUR_LA_SPIRALE \
NOMBRE_DE_POINTS_SAUTES_SUR_LA_SPIRALE \
/* Nombre de points a sauter sur la spirale lors de son parcours. */
#define NOMBRE_DE_POINTS_A_GENERER \
SEIZE \
/* Nombre de points a traiter sur la spirale. */
/*===================================================================================================================================*/
/*************************************************************************************************************************************/
/* */
/* M A C R O S U T I L E S : */
/* */
/*************************************************************************************************************************************/
/*===================================================================================================================================*/
/*************************************************************************************************************************************/
/* */
/* T E S T D U C A L C U L D E S C O O R D O N N E E S D E S P O I N T S D ' U N E S P I R A L E : */
/* */
/*************************************************************************************************************************************/
BCommande(nombre_d_arguments,arguments)
/*-----------------------------------------------------------------------------------------------------------------------------------*/
Bblock
DEFV(CHAR,INIC(POINTERc(nom_imageR),NOM_PIPE));
DEFV(Positive,INIT(nombre_de_points_a_sauter,NOMBRE_DE_POINTS_A_SAUTER_SUR_LA_SPIRALE));
/* Nombre de points a sauter sur la spirale lors de son parcours. */
DEFV(Int,INIT(nombre_de_points_a_generer,NOMBRE_DE_POINTS_A_GENERER));
/* De points a traiter sur la spirale. */
DEFV(pointI_2D,point_courant);
/* Point (entier) courant. */
SPIRALE_DEFINITION
/* Donnees de generation d'une spirale de parcours d'une image. */
DEFV(Int,INIT(index,UNDEF));
/* Index du point courant sur la spirale. */
/*..............................................................................................................................*/
GET_ARGUMENTSi(nombre_d_arguments
,BLOC(GET_ARGUMENT_C("imageR=""R=",nom_imageR);
GET_ARGUMENT_I("nombre=",nombre_de_points_a_generer);
GET_ARGUMENT_I("saut=",nombre_de_points_a_sauter);
)
);
CALi(Inoir(ImageR));
/* Initialisation de l'image Resultat. */
SPIRALE_VALIDATION;
/* Validation des pas de parcours (pasX,pasY) des images. */
INITIALISATION_POINT_2D(point_courant,Xcentre_SPIRALE,Ycentre_SPIRALE);
/* Et on se place au centre de l'image. */
DoIn(index,PREMIER_POINT,LSTX(PREMIER_POINT,nombre_de_points_a_generer),I)
Bblock
store_point_valide(BLANC,ImageR,ASD1(point_courant,x),ASD1(point_courant,y),FVARIABLE);
/* Marquage du point courant... */
CAL2(Prin3("(%d,%d) --> index(%d)\n",ASD1(point_courant,x),ASD1(point_courant,y),index));
SPIRALE_DEPLACEMENT_ET_PARCOURS(ASD1(point_courant,x),ASD1(point_courant,y),nombre_de_points_a_sauter);
/* Deplacement du point courant de la spirale... */
Eblock
EDoI
CALi(Iupdate_image(nom_imageR,ImageR));
CAL2(Prin2("centre=(%d,%d)\n",PINTE(Xcentre_SPIRALE),PINTE(Ycentre_SPIRALE)));
DoIn(index,PREMIER_POINT,LSTX(PREMIER_POINT,nombre_de_points_a_generer),I)
Bblock
CAL2(Prin3("index(%d) --> (%d,%d)\n",index
,SPIRALE_X(index,nombre_de_points_a_sauter)
,SPIRALE_Y(index,nombre_de_points_a_sauter)
)
);
/* Et edition... */
Eblock
EDoI
RETU_Commande;
Eblock
ECommande
Copyright © Jean-François COLONNA, 2019-2024.
Copyright © CMAP (Centre de Mathématiques APpliquées) UMR CNRS 7641 / École polytechnique, Institut Polytechnique de Paris, 2019-2024.