/*************************************************************************************************************************************/
/* */
/* T E S T D E L A G E N E R A T I O N D E S S E R P E N T S : */
/* */
/* */
/* : oo oooo : */
/* : oo + ... */
/* o oo o +++ oo ++ :: ... */
/* o oo ........... + ++ + .. */
/* o : oo :: ........ + oo ........ o +++.. */
/* o: o ..... ++ ::: + ...o. o...++++ */
/* o .o. --......:: ++++oo o o .... ... */
/* : o ... o ..: ..++ o +oo ...... o */
/* : o ... ::::.o ++ o +oo ... o */
/* : o.::: .. oo o ooo ...oo. */
/* : ::..:o ...+ o o o++ o .o. + ... */
/* ::::: .. o .. o+ o+o oo.. + ... */
/* : .. +o.. + o o+ o ooo ... ... */
/* :.. + o + o o+ o o ... + .. */
/* ... + +oo + ooo o ... + ... */
/* ... + + o + oo oo ... + .. */
/* ..- +o oo + o.o. + ... */
/* .. - o+o + o ... o o ... */
/* +... + + o + ... o ... */
/* + .. - + + o ..o o o .. */
/* .. - ++ + o ...o o oo */
/* .. - ++ + + .o. o o */
/* .. ++ .. o o o */
/* .. ++ - + ... o o o */
/* + .. - + .. o oo */
/* .. - +... oo : */
/* .. - .. .... oo : */
/* .. -.. .... o : */
/* .. .-..... + : -- */
/* ..... ...... + - */
/* ...... o- + */
/* ooo */
/* */
/* */
/* Author of '$xrk/serpents.01$K' : */
/* */
/* Jean-Francois COLONNA (LACTAMME, 1989??????????). */
/* */
/*************************************************************************************************************************************/
/*===================================================================================================================================*/
/*************************************************************************************************************************************/
/* */
/* I N T E R F A C E ' listG ' : */
/* */
/* */
/* :Debut_listG: */
/* :Fin_listG: */
/* */
/*************************************************************************************************************************************/
/*===================================================================================================================================*/
/*************************************************************************************************************************************/
/* */
/* D I R E C T I V E S S P E C I F I Q U E S D E C O M P I L A T I O N : */
/* */
/*************************************************************************************************************************************/
/*===================================================================================================================================*/
/*************************************************************************************************************************************/
/* */
/* F I C H I E R S D ' I N C L U D E S : */
/* */
/*************************************************************************************************************************************/
#include INCLUDES_BASE
#include maths_fonct_COURBES_1_EXT
/*===================================================================================================================================*/
/*************************************************************************************************************************************/
/* */
/* P A R A M E T R E S : */
/* */
/*************************************************************************************************************************************/
#define GRAINE 1234 \
/* Graine initiale du generateur aleatoire. */
#define NIVEAU_ORIGINE \
NOIR_PLANCHER_1 \
/* Niveau origine du trace (correspond grossierement au 'Z' ; je dit "grossierement" car */ \
/* en effet pour les niveaux, l'interpolation est lineaire et non pas cubique). */
#define NIVEAU_EXTREMITE \
BLANC \
/* Niveau origine du trace (correspond grossierement au 'Z' ; je dit "grossierement" car */ \
/* en effet pour les niveaux, l'interpolation est lineaire et non pas cubique). */
#define AFFAIBLISSEMENT_AU_BORD \
FU \
/* Afin de faire un degrade du centre vers le bord... */
#define NOMBRE_D_ARCS_F1 \
TROIS \
/* Nombre d'arcs pour la famille 'F1'. */
#define NOMBRE_DE_POINTS_F1 \
QUATRE \
/* Nombre de points definissant le multi-arc de cubique (il y a un arc de moins que */ \
/* de points) de la famille 'F1'. */
#define RAYON_DU_POINT_F1 \
NEUF \
/* Rayon du point representatif de la famille 'F1'. */
#define COULEURS_F1 \
L_SUBSTITUTION_11 \
/* Liste de substitution de trace de la famille 'F1'. */
#define NOMBRE_D_ARCS_F2 \
NEUT(NOMBRE_D_ARCS_F1) \
/* Nombre d'arcs pour la famille 'F2'. */
#define NOMBRE_DE_POINTS_F2 \
NOMBRE_DE_POINTS_F1 \
/* Nombre de points definissant le multi-arc de cubique (il y a un arc de moins que */ \
/* de points) de la famille 'F2'. */
#define RAYON_DU_POINT_F2 \
TIER(RAYON_DU_POINT_F1) \
/* Rayon du point representatif de la famille 'F2'. */
#define COULEURS_F2 \
L_SUBSTITUTION_12 \
/* Liste de substitution de trace de la famille 'F2'. */
#define NOMBRE_D_ARCS_F3 \
DOUB(NOMBRE_D_ARCS_F1) \
/* Nombre d'arcs pour la famille 'F3'. */
#define NOMBRE_DE_POINTS_F3 \
NOMBRE_DE_POINTS_F1 \
/* Nombre de points definissant le multi-arc de cubique (il y a un arc de moins que */ \
/* de points) de la famille 'F3'. */
#define RAYON_DU_POINT_F3 \
TIER(RAYON_DU_POINT_F1) \
/* Rayon du point representatif de la famille 'F3'. */
#define COULEURS_F3 \
L_SUBSTITUTION_13 \
/* Liste de substitution de trace de la famille 'F3'. */
#nodefine NOM_DE_L_IMAGE \
"images/recherches/chaos/SERPENTS.11"
#define NOM_DE_L_IMAGE \
nom_imageR
/* Nom de l'image a generer (mise "en conformite" le 20021103120412). */
/*===================================================================================================================================*/
/*************************************************************************************************************************************/
/* */
/* M A C R O S U T I L E S : */
/* */
/*************************************************************************************************************************************/
#define GENERE_COORDONNEE_ALEATOIRE(coordonnee,borne_inferieure,borne_superieure,_____cNORMALISE_OXYZ) \
Bblock \
CALS(rdnI2D(ADRESSE(pointI_spirale),UNDEF,RDN_INIT,FLOT(borne_inferieure),FLOT(borne_superieure))); \
/* Initialisation du generateur aleatoire. */ \
EGAL(coordonnee \
,_____cNORMALISE_OXYZ(INTE(rdnI2D(ADRESSE(pointI_spirale) \
,graine,RDN_GENERE \
,FLOT__ARGUMENT_ABSENT,FLOT__ARGUMENT_ABSENT \
) \
) \
) \
); \
INCR(graine,I); \
Eblock \
/* Generation d'une coordonnee aleatoire. */
#define GENERE_POINT_ALEATOIRE(point) \
Bblock \
GENERE_COORDONNEE_ALEATOIRE(ASD1(point,x),Xmin,Xmax,_____cNORMALISE_OX); \
GENERE_COORDONNEE_ALEATOIRE(ASD1(point,y),Ymin,Ymax,_____cNORMALISE_OY); \
GENERE_COORDONNEE_ALEATOIRE(ASD1(point,z) \
,COZA(NIVR(NIVEAU_ORIGINE)),COZA(NIVR(NIVEAU_EXTREMITE)) \
,_____cNORMALISE_OZ \
); \
Eblock \
/* Generation d'un point aleatoire. */
#define SET_P1(X0,Y0,Z0) \
Bblock \
INITIALISATION_POINT_3D(pointF_P1,_____cNORMALISE_OX(X0),_____cNORMALISE_OY(Y0),_____cNORMALISE_OZ(Z0)); \
Eblock \
/* Definition du point P1. */
#define SET_P2(X0,Y0,Z0) \
Bblock \
INITIALISATION_POINT_3D(pointF_P2,_____cNORMALISE_OX(X0),_____cNORMALISE_OY(Y0),_____cNORMALISE_OZ(Z0)); \
Eblock \
/* Definition du point P2. */
#define SET_P3(X0,Y0,Z0) \
Bblock \
INITIALISATION_POINT_3D(pointF_P3,_____cNORMALISE_OX(X0),_____cNORMALISE_OY(Y0),_____cNORMALISE_OZ(Z0)); \
Eblock \
/* Definition du point P3. */
#define SET_P4(X0,Y0,Z0) \
Bblock \
INITIALISATION_POINT_3D(pointF_P4,_____cNORMALISE_OX(X0),_____cNORMALISE_OY(Y0),_____cNORMALISE_OZ(Z0)); \
Eblock \
/* Definition du point P4. */
#define MOVE_POINTS \
Bblock \
SET_P1(_cDENORMALISE_OX(ASD1(pointF_P2,x)) \
,_cDENORMALISE_OY(ASD1(pointF_P2,y)) \
,_cDENORMALISE_OZ(ASD1(pointF_P2,z)) \
); \
SET_P2(_cDENORMALISE_OX(ASD1(pointF_P3,x)) \
,_cDENORMALISE_OY(ASD1(pointF_P3,y)) \
,_cDENORMALISE_OZ(ASD1(pointF_P3,z)) \
); \
SET_P3(_cDENORMALISE_OX(ASD1(pointF_P4,x)) \
,_cDENORMALISE_OY(ASD1(pointF_P4,y)) \
,_cDENORMALISE_OZ(ASD1(pointF_P4,z)) \
); \
Eblock \
/* Decalage des points (P1,P2,P3,P4) --> (P2,P3,P4,P4). */
#define DRAW_CUBIQUE_4(rayon_du_point) \
Bblock \
CALS(Ivisualisation_arc_de_cubique_4P(ImageR \
,ADRESSE(pointF_P1) \
,ADRESSE(pointF_P2) \
,NIVA(COZR(_cDENORMALISE_OZ(ASD1(pointF_P2,z)))) \
,ADRESSE(pointF_P3) \
,NIVA(COZR(_cDENORMALISE_OZ(ASD1(pointF_P3,z)))) \
,ADRESSE(pointF_P4) \
,CHOI(_____lNORMALISE_OX(rayon_du_point) \
,_____lNORMALISE_OY(rayon_du_point) \
) \
,AFFAIBLISSEMENT_AU_BORD \
,TRI_DIMENSIONNEL \
) \
); \
Eblock \
/* Trace de l'arc de cubique... */
#define GENERE_UNE_FAMILLE_DE_SERPENTS(nombre_d_arcs,nombre_de_points,couleurs,rayon_du_point) \
Bblock \
SUBSTITUTION(couleurs); \
Komp(numero_de_l_arc,nombre_d_arcs) \
Bblock \
Komp(numero_du_point,SUCC(SUCC(nombre_de_points))) \
Bblock \
SPIRALE_INITIALISATION; \
/* Initialisation dynamique de 'spirale_nombre_de_points_a_traiter'. */ \
Choi(numero_du_point) \
Bblock \
Ca1e(UN) \
Bblock \
GENERE_POINT_ALEATOIRE(pointF_P1); \
/* Initialisation du point 'P1'. */ \
Eblock \
ECa1 \
\
Ca1e(DEUX) \
Bblock \
GENERE_POINT_ALEATOIRE(pointF_P2); \
/* Initialisation du point 'P2'. */ \
Eblock \
ECa1 \
\
Ca1e(TROIS) \
Bblock \
GENERE_POINT_ALEATOIRE(pointF_P3); \
/* Initialisation du point 'P3'. */ \
Eblock \
ECa1 \
\
Defo \
Bblock \
GENERE_POINT_ALEATOIRE(pointF_P4); \
/* Initialisation du point 'P4'. */ \
DRAW_CUBIQUE_4(rayon_du_point); \
/* Trace de l'arc de cubique (P2,P3) a l'aide des points (P1,P2,P3,P4). */ \
MOVE_POINTS; \
/* Et "rotation" des points : (P1,P2,P3,P4) --> (P2,P3,P4,P4). */ \
Eblock \
EDef \
Eblock \
ECho \
SPIRALE_DEPLACEMENT(ASD1(pointI_spirale,x),ASD1(pointI_spirale,y)); \
/* Deplacement du point courant de la spirale... */ \
SPIRALE_PARCOURS; \
/* Parcours de la spirale avec rotation eventuelle de PI/2 du bras courant... */ \
Eblock \
EKom \
Eblock \
EKom \
Eblock \
/* Generation d'une famille de serpents... */
/*===================================================================================================================================*/
/*************************************************************************************************************************************/
/* */
/* T E S T D E L A G E N E R A T I O N D E S S E R P E N T S : */
/* */
/*************************************************************************************************************************************/
BCommande(nombre_d_arguments,arguments)
/*-----------------------------------------------------------------------------------------------------------------------------------*/
Bblock
DEFV(CHAR,INIC(POINTERc(nom_imageR),NOM_PIPE));
DEFV(pointF_3D,pointF_P1);
DEFV(pointF_3D,pointF_P2);
DEFV(pointF_3D,pointF_P3);
DEFV(pointF_3D,pointF_P4);
/* Definition des quatre points definissant l'arc de cubique. */
DEFV(Int,INIT(graine,GRAINE));
/* Graine variable de generation des nombres aleatoires. */
DEFV(pointI_2D,pointI_spirale);
/* Point d'un espace en spirale destinee a generer des nombres aleatoires. */
SPIRALE_DEFINITION
/* Donnees de generation d'une spirale de parcours d'une image. */
/*..............................................................................................................................*/
GET_ARGUMENTSv(nombre_d_arguments
,BLOC(GET_ARGUMENT_C("imageR=""R=",nom_imageR);
)
);
CALi(Inoir(ImageR));
/* R : futur resultat, */
SPIRALE_VALIDATION;
/* Validation des pas de parcours (pasX,pasY) des images. */
INITIALISATION_POINT_2D(pointI_spirale,Xcentre,Ycentre);
/* Initialisation de la spirale. */
SET_FILTRAGE(ACTIF);
GENERE_UNE_FAMILLE_DE_SERPENTS(NOMBRE_D_ARCS_F1,NOMBRE_DE_POINTS_F1,COULEURS_F1,RAYON_DU_POINT_F1);
GENERE_UNE_FAMILLE_DE_SERPENTS(NOMBRE_D_ARCS_F2,NOMBRE_DE_POINTS_F2,COULEURS_F2,RAYON_DU_POINT_F2);
GENERE_UNE_FAMILLE_DE_SERPENTS(NOMBRE_D_ARCS_F3,NOMBRE_DE_POINTS_F3,COULEURS_F3,RAYON_DU_POINT_F3);
CALi(Iupdate_image(NOM_DE_L_IMAGE,ImageR));
RETU_Commande;
Eblock
ECommande