/*************************************************************************************************************************************/ /* */ /* G E N E R A T I O N D ' U N E L I S T E D E P O I N T S A P A R T I R D ' U N E I M A G E : */ /* */ /* */ /* Utilisation : */ /* */ /* Le programme '$xci/liste_points$K' peut etre */ /* utilise, au passage, pour convertir des fichiers */ /* binaires de valeurs flottantes en fichier de type */ /* "texte" compatibles, par exemple, avec les programmes */ /* de '$xrv'. Si ces fichiers binaires sont de type */ /* 'Float', il suffira d'ecrire : */ /* */ /* $xci/liste_points$X A=... standard=FAUX $formatI > ... */ /* */ /* Dans le cas de fichiers de type 'vrai_float_de_base', */ /* on fera : */ /* */ /* $xcg/float_Float$X A=... $formatI | $xci/liste_points$X standard=FAUX $formatI > ... */ /* */ /* Evidemment, il faudra adapter '$formatI' a */ /* la taille du fichier argument ("A="). On */ /* pourra eventuellement donner a '$dimX' la */ /* une valeur egale a la taille du fichier et */ /* a '$dimY' une valeur egale a 1... */ /* */ /* On notera le 20070513113933 que, par defaut, */ /* les coordonnees sont generees dans [0,1]. Si */ /* l'on veut qu'elles conservent les proportions */ /* definies par '$formatI', il conviendra d'utiliser */ /* les parametres : */ /* */ /* carre=VRAI */ /* petit_carre=VRAI */ /* */ /* et le tour sera joue... */ /* */ /* */ /* Author of '$xci/liste_points$K' : */ /* */ /* Jean-Francois COLONNA (LACTAMME, 1998??????????). */ /* */ /*************************************************************************************************************************************/ /*===================================================================================================================================*/ /*************************************************************************************************************************************/ /* */ /* 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 : */ /* */ /*************************************************************************************************************************************/ @define PRAGMA_CL_____MODULE_NON_OPTIMISABLE /*===================================================================================================================================*/ /*************************************************************************************************************************************/ /* */ /* F I C H I E R S D ' I N C L U D E S : */ /* */ /*************************************************************************************************************************************/ #include INCLUDES_BASE #include image_image_IMAGESF_EXT /*===================================================================================================================================*/ /*************************************************************************************************************************************/ /* */ /* P A R A M E T R E S : */ /* */ /*************************************************************************************************************************************/ #include xci/coordonne.01.I" #define NIVEAU_DU_FOND \ NOIR \ /* Definition du niveau du fond de l'image (en general le 'NOIR'). */ #define LISTER_AUSSI_LES_POINTS_DU_FOND \ FAUX \ /* Doit-on lister les points du fond ('VRAI') ou pas ('FAUX'). Ceci a ete introduit le */ \ /* 20031207104339 avec une valeur par defaut garantissant la compatibilite. Cette nouvelle */ \ /* option a ete introduite pour 'v $xiMo/mosaique$vv$Z lister_fond'. */ #define PARCOURIR_L_IMAGE_LIGNE_APRES_LIGNE \ VRAI \ /* Parcours de l'image ligne apres ligne ('VRAI') ou colonne apres colonne ('FAUX'). */ #define DENORMALISER_LES_COORDONNEES \ FAUX #define DENORMALISER_LES_NIVEAUX \ VRAI /* Faut-il denormaliser ('VRAI') ou normaliser ('FAUX') ? */ #define SEQUENTIALISER_LES_COORDONNEES \ FAUX \ /* Si 'IL_FAUT(denormaliser_les_coordonnees)' indique si l'on doit editer le couple {X,Y} */ \ /* des coordonnnes ('FAUX') ou bien les "sequentialiser" ('VRAI'), c'est-a-dire editer la */ \ /* combinaison lineaire de 'X' et de 'Y' qui permet d'indexer sequentiellement le vecteur */ \ /* representant l'image en memoire... */ #define COORDONNEE_Z \ k___Zmin \ /* Eventuelle coordonnee 'Z' a editer. */ #define ITERER_L_EDITION_EN_FONCTION_DE_LA_DISTANCE \ FAUX \ /* Editer chaque point une seule fois ('FAUX') ou bien iterer en fonction de la distance */ \ /* a un certain point ('VRAI') ? */ #define X_POINT_FIXE \ _____cNORMALISE_OX(Xmin) #define Y_POINT_FIXE \ _____cNORMALISE_OY(Ymin) #define Z_POINT_FIXE \ _____cNORMALISE_OZ(Zmin) /* Coordonnee du point par rapport calculer les eventuelles distances... */ #define SEUIL_DE_LA_DISTANCE \ F_INFINI #define FACTEUR_DE_L_EXPONENTIELLE \ FU #define BASE_D_EXPONENTATION_DE_L_INVERSE_DE_LA_DISTANCE \ FU #define FACTEUR_DE_L_EXPOSANT \ FU #define FACTEUR_DE_LA_DISTANCE \ FZERO /* Definition des parametres de la fonction de calcul du nombre d'iterations des editions. */ #define EDITER_LES_MESSAGES_D_EN_TETE \ VRAI #define EDITER_COORDONNEES_XYZ \ FAUX #define EDITER_COORDONNEE_X \ VRAI #define EDITER_COORDONNEE_Y \ VRAI #define EDITER_COORDONNEE_Z \ FAUX #define EDITER_NIVEAU \ VRAI #define EDITER_NOMBRE_DE_POINTS \ VRAI /* Controle de l'edition (l'edition de {X,Y,Z} a ete introduite le 20190501081400...). */ #define COMPATIBILITE_20051204 \ FAUX \ /* Permet de proceder a des editions compatibles a celles qui furent effectues */ \ /* anterieurement au 20051204105633. */ #include xci/valeurs.01.I" /* Introduit le 20051204110147... */ /*===================================================================================================================================*/ /*************************************************************************************************************************************/ /* */ /* M A C R O S U T I L E S : */ /* */ /*************************************************************************************************************************************/ #include xci/valeurs.02.I" /* Introduit le 20051204110147... */ #define EDITION_DES_COORDONNEES_DU_POINT_COURANT \ Bblock \ Test(IL_FAUT(denormaliser_les_coordonnees)) \ Bblock \ Test(IL_FAUT(sequentialiser_les_coordonnees)) \ Bblock \ EDITER_UNE_VALEUR(LINEARISATION_DES_INDEX_XY(X,Y),VRAI,"%d","index"); \ Eblock \ ATes \ Bblock \ EDITER_UNE_VALEUR(X,editer_coordonnee_X,"%d","x"); \ EDITER_UNE_VALEUR(Y,editer_coordonnee_Y,"%d","y"); \ EDITER_UNE_VALEUR(coordonnee_Z,editer_coordonnee_Z,"%d","z"); \ /* Edition "parallele" du couple des coordonnees denormalisees {X,Y[,Z]}. */ \ Eblock \ ETes \ Eblock \ ATes \ Bblock \ Test(IL_FAUT(editer_coordonnees_XYZ)) \ Bblock \ CAL2(Prin3("X=%+.^^^ Y=%+.^^^ Z=%+.^^^\n",Xf,Yf,Zf)); \ /* Introduit le 20190501081400 pour 'v $xiirf/.FRC3.84.1.$U eXYZ'... */ \ Eblock \ ATes \ Bblock \ EDITER_UNE_VALEUR_FLOTTANTE(Xf,editer_coordonnee_X,"x"); \ EDITER_UNE_VALEUR_FLOTTANTE(Yf,editer_coordonnee_Y,"y"); \ EDITER_UNE_VALEUR_FLOTTANTE(Zf,editer_coordonnee_Z,"z"); \ Eblock \ ETes \ Eblock \ ETes \ Eblock \ /* Procedure d'edition des coordonnees du point courant. */ #define EDITION_DU_POINT_COURANT \ Bblock \ DEFV(Positive,INIT(nombre_d_editions,UNDEF)); \ /* Nombre d'editions du point courant. A compter du 20020215120701, il est possible */ \ /* d'iterer le nombre d'editions un nombre de fois d'autant plus grand que le point */ \ /* courant {Xf,Yf,Zf} est proche d'un certain point dit "fixe"... */ \ DEFV(Float,INIT(Xf,TRANS_SUPER_cNORMALISE_OX(X,translation_des_X_normalisees))); \ DEFV(Float,INIT(Yf,TRANS_SUPER_cNORMALISE_OY(Y,translation_des_Y_normalisees))); \ DEFV(Float,INIT(Zf,TRANS_SUPER_cNORMALISE_OZ(coordonnee_Z,translation_des_Z_normalisees))); \ /* Coordonnees normalisees {Xf,Yf,Zf} du point courant (introduites le 20020215112234). */ \ DEFV(Float,INIT(distance_courante,FLOT__UNDEF)); \ /* Distance du point courant {Xf,Yf,Zf} au "point fixe". */ \ \ Test(IL_FAUT(iterer_l_edition_en_fonction_de_la_distance)) \ Bblock \ EGAL(distance_courante \ ,RdisF3D(X_point_fixe,Y_point_fixe,Z_point_fixe \ ,Xf,Yf,Zf \ ) \ ); \ Eblock \ ATes \ Bblock \ Eblock \ ETes \ \ EGAL(nombre_d_editions \ ,COND(IFOU(IL_NE_FAUT_PAS(iterer_l_edition_en_fonction_de_la_distance) \ ,IFET(IL_FAUT(iterer_l_edition_en_fonction_de_la_distance) \ ,IFGT(distance_courante,seuil_de_la_distance) \ /* Le test 'IFGT(...)' est choisi de facon a etre compatible avec le test complementaire */ \ /* de detection des valeurs intermediaires dans 'v $xrv/passe_ban.01$K INCL' et ce a cause */ \ /* de l'utilisation qui en est faite dans 'v $xiird/.ACIN.K.16.$U passe_ban.01' pour la */ \ /* generation de la sequence 'v _____xivPdf_14_1/019791_020302'... */ \ ) \ ) \ ,UN \ ,INTE(MUL2(facteur_de_l_exponentielle \ ,PUIX(base_d_exponentation_de_l_inverse_de_la_distance \ ,DIVI(facteur_de_l_exposant \ ,ADD2(FU,MUL2(facteur_de_la_distance,distance_courante)) \ ) \ ) \ ) \ ) \ ) \ ); \ /* Nombre d'editions du point courant. A compter du 20020215120701, il est possible */ \ /* d'iterer le nombre d'editions un nombre de fois d'autant plus grand que le point */ \ /* courant {Xf,Yf,Zf} est plus proche d'un certain point dit "fixe". La formule utilisee */ \ /* est du type : */ \ /* */ \ /* Fe */ \ /* ------------------ */ \ /* 1 + (Fd.distance) */ \ /* */ \ /* N = F.base */ \ /* */ \ /* ou 'N' represente 'nombre_d_editions'. */ \ \ Repe(nombre_d_editions) \ Bblock \ Test(EST_VRAI(les_images_sont_standards)) \ Bblock \ DEFV(genere_p,INIT(niveau_du_point_courant,load_point(ImageA,X,Y))); \ /* Niveau du point courant {X,Y}. */ \ \ Test(IFOU(IL_FAUT(lister_aussi_les_points_du_fond) \ ,IFET(IL_NE_FAUT_PAS(lister_aussi_les_points_du_fond) \ ,IFNE(niveau_du_point_courant,niveau_du_fond) \ ) \ ) \ ) \ Bblock \ INCR(nombre_de_points_trouves,I); \ /* Comptage des points n'appartenant pas au fond, en notant bien que ce comptage prend bien */ \ /* en compte la repetitions suivant 'nombre_d_editions' qui precede... */ \ \ EDITION_DES_COORDONNEES_DU_POINT_COURANT; \ \ Test(IL_FAUT(denormaliser_les_niveaux)) \ Bblock \ EDITER_UNE_VALEUR(niveau_du_point_courant,editer_niveau,"%d","n"); \ Eblock \ ATes \ Bblock \ EDITER_UNE_VALEUR_FLOTTANTE(______NORMALISE_NIVEAU(niveau_du_point_courant),editer_niveau,"n"); \ Eblock \ ETes \ Eblock \ ATes \ Bblock \ Eblock \ ETes \ Eblock \ ATes \ Bblock \ DEFV(genere_Float,INIT(niveau_du_point_courant,loadF_point(IFmageA,X,Y))); \ /* Niveau du point courant {X,Y}. */ \ \ EDITION_DES_COORDONNEES_DU_POINT_COURANT; \ \ EDITER_UNE_VALEUR_FLOTTANTE(niveau_du_point_courant,editer_niveau,"n"); \ Eblock \ ETes \ Eblock \ ERep \ Eblock \ /* Procedure d'edition du point courant. */ #define gEDITER_UNE_VALEUR(valeur,editer,sequence_d_edition,message_d_en_tete) \ Bblock \ Test(IL_FAUT(editer)) \ Bblock \ Test(IL_FAUT(editer_les_messages_d_en_tete)) \ Bblock \ CAL2(Prin1("%s=",message_d_en_tete)); \ Eblock \ ATes \ Bblock \ Eblock \ ETes \ \ BLOC(sequence_d_edition); \ Eblock \ ATes \ Bblock \ Eblock \ ETes \ Eblock \ /* Procedure d'edition conditionnelle. */ #define EDITER_UNE_VALEUR(valeur,editer,format,message_d_en_tete) \ Bblock \ gEDITER_UNE_VALEUR(valeur \ ,editer \ ,BLOC(CAL2(Prin1(Cara(chain_Aconcaten2(format,"\n")),valeur));) \ ,message_d_en_tete \ ); \ Eblock \ /* Procedure d'edition conditionnelle. */ #define EDITER_UNE_VALEUR_FLOTTANTE(valeur,editer,message_d_en_tete) \ Bblock \ Test(IL_FAUT(compatibilite_20051204)) \ Bblock \ EDITER_UNE_VALEUR(valeur,editer,"%+.^^^",message_d_en_tete) \ /* Le 20060105155132, le format "16g" est passe a "^^g" pour plus de souplesse... */ \ /* */ \ /* Le 20091123123241, le format "^^g" est passe a "^^^" pour plus de souplesse... */ \ Eblock \ ATes \ Bblock \ gEDITER_UNE_VALEUR(valeur \ ,editer \ ,BLOC(CAL2(Prin2(Cara(chain_Aconcaten5(INTRODUCTION_FORMAT \ ,valeurs_signees \ ,".*" \ ,format_d_edition \ ,"\n" \ ) \ ) \ ,NOMBRE_DE_DECIMALES_EFFECTIF(nombre_de_decimales) \ ,MULTIPLE_DE(ENTIER_FLOTTANT(valeur)) \ ) \ ); \ ) \ ,message_d_en_tete \ ); \ Eblock \ ETes \ Eblock \ /* Procedure d'edition d'une valeur flottante (introduite le 20051204110501)... */ /*===================================================================================================================================*/ /*************************************************************************************************************************************/ /* */ /* G E N E R A T I O N D ' U N E L I S T E D E P O I N T S A P A R T I R D ' U N E I M A G E : */ /* */ /*************************************************************************************************************************************/ BCommande(nombre_d_arguments,arguments) /*-----------------------------------------------------------------------------------------------------------------------------------*/ Bblock DEFV(CHAR,INIC(POINTERc(nom_imageA),NOM_PIPE)); #include xci/coordonne.02.I" DEFV(genere_p,INIT(niveau_du_fond,NIVEAU_DU_FOND)); /* Definition du niveau du fond de l'image (en general le 'NOIR'). */ DEFV(Logical,INIT(lister_aussi_les_points_du_fond,LISTER_AUSSI_LES_POINTS_DU_FOND)); /* Doit-on lister les points du fond ('VRAI') ou pas ('FAUX'). Ceci a ete introduit le */ /* 20031207104339 avec une valeur par defaut garantissant la compatibilite. Cette nouvelle */ /* option a ete introduite pour 'v $xiMo/mosaique$vv$Z lister_fond'. */ DEFV(Logical,INIT(parcourir_l_image_ligne_apres_ligne,PARCOURIR_L_IMAGE_LIGNE_APRES_LIGNE)); /* Parcours de l'image ligne apres ligne ('VRAI') ou colonne apres colonne ('FAUX'). */ DEFV(Logical,INIT(denormaliser_les_coordonnees,DENORMALISER_LES_COORDONNEES)); DEFV(Logical,INIT(denormaliser_les_niveaux,DENORMALISER_LES_NIVEAUX)); /* Faut-il denormaliser ('VRAI') ou normaliser ('FAUX') ? */ DEFV(Logical,INIT(sequentialiser_les_coordonnees,SEQUENTIALISER_LES_COORDONNEES)); /* Si 'IL_FAUT(denormaliser_les_coordonnees)' indique si l'on doit editer le couple {X,Y} */ /* des coordonnnes ('FAUX') ou bien les "sequentialiser" ('VRAI'), c'est-a-dire editer la */ /* combinaison lineaire de 'X' et de 'Y' qui permet d'indexer sequentiellement le vecteur */ /* representant l'image en memoire... */ DEFV(Int,INIT(coordonnee_Z,COORDONNEE_Z)); /* Eventuelle coordonnee 'Z' a editer. */ DEFV(Logical,INIT(iterer_l_edition_en_fonction_de_la_distance,ITERER_L_EDITION_EN_FONCTION_DE_LA_DISTANCE)); /* Editer chaque point une seule fois ('FAUX') ou bien iterer en fonction de la distance */ /* a un certain point ('VRAI') ? */ DEFV(Float,INIT(X_point_fixe,X_POINT_FIXE)); DEFV(Float,INIT(Y_point_fixe,Y_POINT_FIXE)); DEFV(Float,INIT(Z_point_fixe,Z_POINT_FIXE)); /* Coordonnee du point par rapport calculer les eventuelles distances... */ DEFV(Float,INIT(seuil_de_la_distance,SEUIL_DE_LA_DISTANCE)); DEFV(Float,INIT(facteur_de_l_exponentielle,FACTEUR_DE_L_EXPONENTIELLE)); DEFV(Float,INIT(base_d_exponentation_de_l_inverse_de_la_distance,BASE_D_EXPONENTATION_DE_L_INVERSE_DE_LA_DISTANCE)); DEFV(Float,INIT(facteur_de_l_exposant,FACTEUR_DE_L_EXPOSANT)); DEFV(Float,INIT(facteur_de_la_distance,FACTEUR_DE_LA_DISTANCE)); /* Definition des parametres de la fonction de calcul du nombre d'iterations des editions. */ DEFV(Logical,INIT(editer_les_messages_d_en_tete,EDITER_LES_MESSAGES_D_EN_TETE)); DEFV(Logical,INIT(editer_coordonnees_XYZ,EDITER_COORDONNEES_XYZ)); DEFV(Logical,INIT(editer_coordonnee_X,EDITER_COORDONNEE_X)); DEFV(Logical,INIT(editer_coordonnee_Y,EDITER_COORDONNEE_Y)); DEFV(Logical,INIT(editer_coordonnee_Z,EDITER_COORDONNEE_Z)); DEFV(Logical,INIT(editer_niveau,EDITER_NIVEAU)); DEFV(Logical,INIT(editer_nombre_de_points,EDITER_NOMBRE_DE_POINTS)); /* Controle de l'edition (l'edition de {X,Y,Z} a ete introduite le 20190501081400...). */ #include xci/valeurs.03.I" /* Introduit le 20051204110147... */ DEFV(Logical,INIT(compatibilite_20051204,COMPATIBILITE_20051204)); /* Permet de proceder a des editions compatibles a celles qui furent effectues */ /* anterieurement au 20051204105633. */ /*..............................................................................................................................*/ #include xci/coordonne.04.I" /* Ceci a ete introduit le 20051218182225... */ GET_ARGUMENTSi(nombre_d_arguments ,BLOC(GET_ARGUMENT_L("compatibilite_20051204=",compatibilite_20051204); GET_ARGUMENT_C("imageA=""A=",nom_imageA); GET_ARGUMENT_L("standard=",les_images_sont_standards); GET_ARGUMENT_L("centrer=",centrer_les_coordonnees_normalisees); GET_ARGUMENT_P("fond=",niveau_du_fond); GET_ARGUMENT_L("lister_fond=""lf=",lister_aussi_les_points_du_fond); GET_ARGUMENT_L("lignes=""ligne=",parcourir_l_image_ligne_apres_ligne); GET_ARGUMENT_L("Cdenormaliser=",denormaliser_les_coordonnees); GET_ARGUMENT_N("Cnormaliser=",denormaliser_les_coordonnees); GET_ARGUMENT_L("Ndenormaliser=",denormaliser_les_niveaux); GET_ARGUMENT_N("Nnormaliser=",denormaliser_les_niveaux); GET_ARGUMENT_L("sequentiel=""sequentialiser=",sequentialiser_les_coordonnees); GET_ARGUMENT_L("messages=""message=""en_tete=",editer_les_messages_d_en_tete); GET_ARGUMENT_I("Z=",coordonnee_Z); GET_ARGUMENT_L("iterer=""dupliquer=",iterer_l_edition_en_fonction_de_la_distance); GET_ARGUMENT_F("Xc=",X_point_fixe); GET_ARGUMENT_F("Yc=",Y_point_fixe); GET_ARGUMENT_F("Zc=",Z_point_fixe); GET_ARGUMENT_F("seuil=",seuil_de_la_distance); GET_ARGUMENT_F("f=""Fexponentielle=",facteur_de_l_exponentielle); GET_ARGUMENT_F("base=",base_d_exponentation_de_l_inverse_de_la_distance); GET_ARGUMENT_F("fe=""Fexposant=",facteur_de_l_exposant); GET_ARGUMENT_F("fd=""Fdistance=",facteur_de_la_distance); GET_ARGUMENT_L("xyz=""exyz=""eXYZ=""XYZ=",editer_coordonnees_XYZ); /* Parametres introduits le 20190501081400... */ GET_ARGUMENT_L("x=""ex=""eX=""X=",editer_coordonnee_X); GET_ARGUMENT_L("y=""ey=""eY=""Y=",editer_coordonnee_Y); GET_ARGUMENT_L("z=""ez=""eZ=",editer_coordonnee_Z); /* Les parametres {"x=","X=","y=","Y=","z="} ont ete introduits le 20070411092646 et l'on */ /* notera l'absence de "Z=" qui existe par ailleurs (pour 'coordonnee_Z'...). */ GET_ARGUMENT_L("eniveau=""en=""eNIVEAU=""eN=""n=""N=",editer_niveau); /* Les parametres {"n=","N="} ont ete introduits le 20070411184609... */ GET_ARGUMENT_L("points=""nombre=""epoints=""ep=",editer_nombre_de_points); /* Le parametre "nombre=" a ete introduit le 20070411184609... */ PROCESS_ARGUMENTS_DE_PARAMETRAGE_DE_LA_GENERATION_DE_SUITE_DE_VALEURS_1; /* Cette procedure fut introduite le 20061226185213... */ ) ); #include xci/coordonne.03.I" Test(PAS_D_ERREUR(CODE_ERROR(gIload_image(les_images_sont_standards,ImageA,IFmageA,nom_imageA)))) Bblock /* Chargement de l'image a convertir en une liste. */ DEFV(Int,INIT(nombre_de_points_trouves,ZERO)); /* Comptage des points n'appartenant pas au fond... */ Test(IL_FAUT(parcourir_l_image_ligne_apres_ligne)) Bblock /* Parcours de l'image ligne apres ligne : */ begin_colonne Bblock begin_ligne Bblock EDITION_DU_POINT_COURANT; /* Edition du point courant {X,Y}. */ Eblock end_ligne Eblock end_colonne Eblock ATes Bblock /* Parcours de l'image colonne apres colonne : */ begin_ligne Bblock begin_colonne Bblock EDITION_DU_POINT_COURANT; /* Edition du point courant {X,Y}. */ Eblock end_colonne Eblock end_ligne Eblock ETes EDITER_UNE_VALEUR(nombre_de_points_trouves,editer_nombre_de_points,"%d","points"); Eblock ATes Bblock Test__CODE_ERREUR__ERREUR07; Eblock ETes RETU_Commande; Eblock ECommande