/*************************************************************************************************************************************/
/*                                                                                                                                   */
/*        P R E S E N T A T I O N   D E   L ' I M A G E   A R G U M E N T   E N   4   V U E S   S A N S   T E X T U R E  :           */
/*                                                                                                                                   */
/*                                                                                                                                   */
/*        Definition :                                                                                                               */
/*                                                                                                                                   */
/*                    Cette commande genere une image                                                                                */
/*                  dont le nom est le premier argument                                                                              */
/*                  d'appel ; elle donne 4 vues de celle-ci :                                                                        */
/*                                                                                                                                   */
/*                  HG : telle quelle,                                                                                               */
/*                  HD : montagne vue d'avion,                                                                                       */
/*                  BD : montagne (sens positif),                                                                                    */
/*                  BG : montagne (sens negatif).                                                                                    */
/*                                                                                                                                   */
/*                                                                                                                                   */
/*        Author of '$xci/montagne.02$K' :                                                                                           */
/*                                                                                                                                   */
/*                    Jean-Francois COLONNA (LACTAMME, 1988??????????).                                                              */
/*                                                                                                                                   */
/*************************************************************************************************************************************/

/*===================================================================================================================================*/
/*************************************************************************************************************************************/
/*                                                                                                                                   */
/*        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  image_image_MONTAGNES_EXT

/*===================================================================================================================================*/
/*************************************************************************************************************************************/
/*                                                                                                                                   */
/*        P A R A M E T R E S  :                                                                                                     */
/*                                                                                                                                   */
/*************************************************************************************************************************************/
#define   EFFACEMENT                                                                                                                    \
                    VRAI                                                                                                                \
                                        /* Pour effacer initialement l'image a generer.                                              */
#define   OMBRES                                                                                                                        \
                    VRAI                                                                                                                \
                                        /* Pour generer les ombres portees.                                                          */
#define   PENOMBRE                                                                                                                      \
                    FLOT(DOUZE)                                                                                                         \
                                        /* Largeur de la zone de penombre.                                                           */
#define   DEPTH                                                                                                                         \
                    VRAI                                                                                                                \
                                        /* Pour faire du "depth-cueing".                                                             */
#define   MIN_DEPTH_CUEING                                                                                                              \
                    FZERO                                                                                                               \
                                        /* Pour faire du "depth-cueing".                                                             */
#define   AVION                                                                                                                         \
                    FAUX                                                                                                                \
                                        /* Pour voir la montagne en perspective.                                                     */
#define   ALIAS                                                                                                                         \
                    VRAI                                                                                                                \
                                        /* Pour faire le traitement anti-aliasing.                                                   */
#define   ECHELLE                                                                                                                       \
                    FU                                                                                                                  \
                                        /* On laisse le champ invariant...                                                           */
#define   X_TRANSLATION                                                                                                                 \
                    FZERO                                                                                                               \
                                        /* Translation horizontale,                                                                  */
#define   Y_TRANSLATION                                                                                                                 \
                    PARE(0.85000)                                                                                                       \
                                        /* Translation verticale,                                                                    */
#define   X_LUMIERE                                                                                                                     \
                    FLOT(HUIT)                                                                                                          \
                                        /* Abscisse de la source lumineuse,                                                          */
#define   Y_LUMIERE                                                                                                                     \
                    FLOT(HUIT)                                                                                                          \
                                        /* Ordonnee de la source lumineuse.                                                          */
#define   FACTEUR_MULTIPLICATIF_DE_CONVOLUTION                                                                                          \
                    FU                                                                                                                  \
                                        /* Facteur multiplicatif du produit de convolution en chaque point {X,Y}.                    */

#define   NOMBRE_DE_POINTS_DU_NOYAU                                                                                                     \
                    EXP2(DOUP(ZERO))                                                                                                    \
                                        /* Nombre de points du noyau (introduit sous cette forme le 20111031144434).                 */

/*===================================================================================================================================*/
/*************************************************************************************************************************************/
/*                                                                                                                                   */
/*        C H O I X   D E S   C O U L E U R S  :                                                                                     */
/*                                                                                                                                   */
/*************************************************************************************************************************************/
                                        /* Le 20030316103105, les 'VERSION_0?' ont ete remplace par 'CHOIX_DES_COULEURS_VERSION_0?'  */
                                        /* afin de permettre leur recuperation dans 'v $xcc/cpp$Z _VERSION_'.                        */

#nodefine CHOIX_DES_COULEURS_VERSION_01                                                                                                 \
                                        /* Version avec deux jeux de couleurs.                                                       */
#define   CHOIX_DES_COULEURS_VERSION_02                                                                                                 \
                                        /* Version avec quatre jeux de couleurs.                                                     */

#ifdef    CHOIX_DES_COULEURS_VERSION_01
#    define    LISTE_HG                                                                                                                 \
                         SUBSTITUTION(L_SUBSTITUTION_01);
#    define    LISTE_HD                                                                                                                 \
                         SUBSTITUTION(L_SUBSTITUTION_02);
#    define    LISTE_BD                                                                                                                 \
                         SUBSTITUTION(L_SUBSTITUTION_02);
#    define    LISTE_BG                                                                                                                 \
                         SUBSTITUTION(L_SUBSTITUTION_02);
#Aifdef   CHOIX_DES_COULEURS_VERSION_01
#Eifdef   CHOIX_DES_COULEURS_VERSION_01

#ifdef    CHOIX_DES_COULEURS_VERSION_02
#    define    LISTE_HG                                                                                                                 \
                         SUBSTITUTION(L_SUBSTITUTION_11);
#    define    LISTE_HD                                                                                                                 \
                         SUBSTITUTION(L_SUBSTITUTION_12);
#    define    LISTE_BD                                                                                                                 \
                         SUBSTITUTION(L_SUBSTITUTION_14);
#    define    LISTE_BG                                                                                                                 \
                         SUBSTITUTION(L_SUBSTITUTION_13);
#Aifdef   CHOIX_DES_COULEURS_VERSION_02
#Eifdef   CHOIX_DES_COULEURS_VERSION_02

/*===================================================================================================================================*/
/*************************************************************************************************************************************/
/*                                                                                                                                   */
/*        M A C R O S   U T I L E S  :                                                                                               */
/*                                                                                                                                   */
/*************************************************************************************************************************************/
#define   NOYAU(numero,valeur)                                                                                                          \
                    Bblock                                                                                                              \
                    EGAL(ITb1(noyau,INDX(numero,PREMIER_POINT)),valeur);                                                                \
                    EGAL(ITb1(inhibition_du_noyau,INDX(numero,PREMIER_POINT)),ACTIF);                                                   \
                    Eblock

/*===================================================================================================================================*/
/*************************************************************************************************************************************/
/*                                                                                                                                   */
/*        E X E C U T I O N   D E   L A   M I S E   E N   M O N T A G N E  :                                                         */
/*                                                                                                                                   */
/*************************************************************************************************************************************/
BCommande(nombre_d_arguments,arguments)
/*-----------------------------------------------------------------------------------------------------------------------------------*/
     Bblock
     DEFV(CHAR,INIC(POINTERc(nom_imageR),NOM_PIPE));
     DEFV(CHAR,INIC(POINTERc(nom_imageA),NOM_PIPE));
     DEFV(Float,INIT(echelle,ECHELLE));
                                        /* Facteur d'echelle a appliquer a l'image Argument.                                         */
     DEFV(deltaF_2D,translation);
                                        /* Translation de la montagne dans l'image.                                                  */
     DEFV(pointF_2D,source_lumineuse);
                                        /* Position de la source lumineuse.                                                          */
     DEFV(Logical,INIT(effacement,EFFACEMENT));
                                        /* Pour l'effacement initial de l'image Resultat.                                            */
     DEFV(Logical,INIT(ombres,OMBRES));
                                        /* Pour mettre ou pas les ombres portees,                                                    */
     DEFV(Float,INIT(penombre,PENOMBRE));
                                        /* Largeur de la zone de penombre.                                                           */
     DEFV(Logical,INIT(depth,DEPTH));
                                        /* Pour faire ou pas du "depth-cueing",                                                      */
     DEFV(Float,INIT(min_depth_cueing,MIN_DEPTH_CUEING));
                                        /* Pour ponderer dans [0,1] le "depth-cueing" : plus on est proche de                        */
                                        /* zero, plus il est fort...                                                                 */
     DEFV(Logical,INIT(avion,AVION));
                                        /* Pour voir d'avion ou pas la montagne.                                                     */
     DEFV(Logical,INIT(alias,ALIAS));
                                        /* Pour faire ou pas le traitement anti-aliasing.                                            */
     DEFV(Positive,INIT(hauteur,CINQ));
                                        /* Hauteur par defaut de la mire de barres.                                                  */
     DEFV(Logical,DTb1(niveaux_a_traiter,COULEURS));
                                        /* Definit les niveaux sur lesquels on doit faire la convolution par 'Pconvolution()'.       */
     DEFV(Logical,DTb1(niveaux_cumulables,COULEURS));
                                        /* Definit les niveaux cumulables lors du calcul de 'Pconvolution_____cumul_courant'.        */
     DEFV(Float,INIT(facteur_multiplicatif,FACTEUR_MULTIPLICATIF_DE_CONVOLUTION));
                                        /* Facteur multiplicatif du produit de convolution en chaque point {X,Y}.                    */
     DEFV(Int,INIT(nombre_de_points,EXP2(DOUP(ZERO))));
                                        /* Nombre de points du noyau.                                                                */
     DEFV(Float,DTb1(noyau,TAILLE_MAXIMALE_D_UN_NOYAU_DE_CONVOLUTION));
                                        /* Noyau de la convolution,                                                                  */
     DEFV(Logical,DTb1(inhibition_du_noyau,TAILLE_MAXIMALE_D_UN_NOYAU_DE_CONVOLUTION));
                                        /* Et sa liste d'inhibition.                                                                 */
     DEFV(Int,INIT(index,UNDEF));
                                        /* Index d'initialisation du noyau.                                                          */
     /*..............................................................................................................................*/
     INITIALISATION_ACCROISSEMENT_2D(translation,X_TRANSLATION,Y_TRANSLATION);
                                        /* Initialisation par defaut de la translation de la montagne.                               */
     INITIALISATION_POINT_2D(source_lumineuse,X_LUMIERE,Y_LUMIERE);
                                        /* Initialisation par defaut de la source lumineuse.                                         */
     GET_ARGUMENTSg(nombre_d_arguments
                   ,BLOC(GET_ARGUMENT_L("Ireduction_moitie_____compatibilite_20030611=""compatibilite_20030611="
                                       ,Ireduction_moitie_____compatibilite_20030611
                                        );
                         GET_ARGUMENT_L("SX_SY_SZ_____compatibilite_20070416=""compatibilite_20070416="
                                       ,SX_SY_SZ_____compatibilite_20070416
                                        );
                                        /* Parametre introduit le 20070416161136...                                                  */

                         GET_ARGUMENT_C("imageA=""A=",nom_imageA);
                         GET_ARGUMENT_C("imageR=""R=",nom_imageR);

                         GET_ARGUMENT_L("tore=",Pconvolution_____placer_l_image_sur_un_tore);
                         GET_ARGUMENT_L("ponderations_utiles=",Pconvolution_____normaliser_uniquement_avec_les_ponderations_utilisees);
                         GET_ARGUMENT_F("Tx=",ASD1(translation,dx));
                         GET_ARGUMENT_F("Ty=",ASD1(translation,dy));
                         GET_ARGUMENT_F("sx=""sX=""Sx=""SX=",ASD1(source_lumineuse,x));
                         GET_ARGUMENT_F("sy=""sY=""Sy=""SY=",ASD1(source_lumineuse,y));
                         GET_ARGUMENT_L("init=",effacement);
                         GET_ARGUMENT_L("ombres=",ombres);
                         GET_ARGUMENT_F("penombre=",penombre);
                         GET_ARGUMENT_L("depth_cueing=""depth=",depth);
                         GET_ARGUMENT_F("minimum=""min_depth_cueing=""min=",min_depth_cueing);
                                        /* Le 20110223145305 furent introduits "depth_cueing=" et "min_depth_cueing="...             */
                         GET_ARGUMENT_L("avion=",avion);
                         GET_ARGUMENT_F("perspective=",Imontagnes_precises_____facteur_de_correction_perspective);
                         GET_ARGUMENT_L("verification_perspective=""vp="
                                       ,Imontagnes_precises_____verification_de_la_correction_perspective
                                        );
                                        /* Introduit le 20170413104007...                                                            */
                         GET_ARGUMENT_L("alias=",alias);
                         GET_ARGUMENT_L("Imontagnes_precises_____compatibilite_20061220=""compatibilite_20061220="
                                       ,Imontagnes_precises_____compatibilite_20061220
                                        );
                                        /* Introduit le 20061220110401...                                                            */
                         GET_ARGUMENT_L("Imontagnes_precises_____compatibilite_20090130=""compatibilite_20090130="
                                       ,Imontagnes_precises_____compatibilite_20090130
                                        );
                                        /* Introduit le 20090130182220...                                                            */
                         GET_ARGUMENT_L("Imontagnes_precises_____compatibilite_20090202=""compatibilite_20090202="
                                       ,Imontagnes_precises_____compatibilite_20090202
                                        );
                                        /* Introduit le 20090202104109...                                                            */
                         GET_ARGUMENT_L("Imontagnes_precises_____compatibilite_20090203=""compatibilite_20090203="
                                       ,Imontagnes_precises_____compatibilite_20090203
                                        );
                                        /* Introduit le 20090203155145...                                                            */
                         GET_ARGUMENT_L("Imontagnes_precises_____compatibilite_20210928=""compatibilite_20210928="
                                       ,Imontagnes_precises_____compatibilite_20210928
                                        );
                                        /* Introduit le 20210928141455...                                                            */
                         GET_ARGUMENT_L("Imontagnes_precises_____compatibilite_20211001=""compatibilite_20211001="
                                       ,Imontagnes_precises_____compatibilite_20211001
                                        );
                                        /* Introduit le 20211001180959...                                                            */

                         GET_ARGUMENT_F("fc1=""facteur_cretes_1="
                                       ,Imontagnes_precises_____facteur_1_interpolation_toutes_lignes_de_crete
                                        );
                         GET_ARGUMENT_F("fc2=""facteur_cretes_2="
                                       ,Imontagnes_precises_____facteur_2_interpolation_toutes_lignes_de_crete
                                        );
                                        /* Introduit le 20061220120509 et etendu le 20061220135129 a deux facteurs...                */
                         GET_ARGUMENT_I("h=",hauteur);
                         GET_ARGUMENT_F("facteur=""f=",facteur_multiplicatif);
                         GET_ARGUMENT_I("points=""p=",nombre_de_points);
                         GET_ARGUMENT_I("spirale_horizontal=",SPIRALE_DEFINITION_____facteur_delta_horizontal);
                         GET_ARGUMENT_I("spirale_vertical=",SPIRALE_DEFINITION_____facteur_delta_vertical);
                         )
                    );

     CALi(Inoir(ImageR));
                                        /* Initialisation de l'image Resultat.                                                       */

     Test(PAS_D_ERREUR(CODE_ERROR(Iload_image(ImageA1,nom_imageA))))
                                        /* Chargement de l'image a transformer.                                                      */
          Bblock
          Test(IFLE(nombre_de_points,TAILLE_MAXIMALE_D_UN_NOYAU_DE_CONVOLUTION))
               Bblock
               DoIn(index,PREMIER_POINT,LSTX(PREMIER_POINT,nombre_de_points),I)
                    Bblock
                    NOYAU(index,FU);
                                        /* Initialisation du noyau de convolution.                                                   */
                    Eblock
               EDoI
               Eblock
          ATes
               Bblock
               PRINT_ERREUR("la taille demandee pour le noyau de convolution est incompatible avec les definitions");

               EGAL(nombre_de_points,NOMBRE_DE_POINTS_DU_NOYAU);
               CAL1(Prer1("(la valeur %d par defaut est forcee)\n",nombre_de_points));
                                        /* Introduit le 20111031141404 car, en effet, manquait cruellement...                        */
               Eblock
          ETes

          CALS(Imove(ImageG,ImageA1));
          MIRE_DE_BARRES(hauteur);
                                        /* Et enfin, mise en place d'une mire de barres...                                           */
          CALS(Imove(ImageA2,ImageG));
          CALi(Inoir(ImageG));
                                        /* Initialisation de l'image finale...                                                       */
          SET_FILTRAGE(ACTIF);
          LISTE_HG;
          DEMI_FENETRE_HG(ImageG,ImageA2,VRAI,CALCUL_DU_MAXIMUM_DANS_UNE_DEMI_FENETRE);
                                        /* HG : presentation de l'image telle quelle...                                              */
          SET_FILTRAGE(INACTIF);

          BoIn(niveau,NOIR,BLANC,PAS_COULEURS)
               Bblock
               EGAL(ITb1(niveaux_a_traiter,INDX(niveau,NOIR)),VRAI);
               EGAL(ITb1(niveaux_cumulables,INDX(niveau,NOIR)),VRAI);
                                        /* Initialisation telle que tous les niveaux soient a la fois "traitables" et "cumulables".  */
               Eblock
          EBoI

          CALS(Iconvolution(ImageR
                           ,facteur_multiplicatif
                           ,ImageA1
                           ,niveaux_a_traiter,niveaux_cumulables
                           ,nombre_de_points,noyau,inhibition_du_noyau
                            )
               );
                                        /* Et "legere" convolution de l'image Argument.                                              */
          CALS(Imove(ImageA1,ImageR));
          CALS(Iblanc(ImageA2));
                                        /* Initialisation de la texture (neutre).                                                    */
          CALS(Iinit_Z_Buffer());
                                        /* Initialisation du 'Z-Buffer'.                                                             */
          CALS(Imontagnes(ImageR
                         ,echelle,ImageA1
                         ,ImageA2
                         ,effacement
                         ,ADRESSE(translation)
                         ,ombres,penombre,ADRESSE(source_lumineuse)
                         ,NOTL(DEPTH),min_depth_cueing
                         ,NOTL(AVION)
                         ,NOTL(ALIAS)
                          )
               );
          SET_FILTRAGE(ACTIF);
          LISTE_HD;
          DEMI_FENETRE_HD(ImageG,ImageR,VRAI,CALCUL_DU_MAXIMUM_DANS_UNE_DEMI_FENETRE);
                                        /* HD : presentation de l'image en montagnes vues d'avion...                                 */
          SET_FILTRAGE(INACTIF);
          CALS(Iinit_Z_Buffer());
                                        /* Initialisation du 'Z-Buffer'.                                                             */
          CALS(Imontagnes(ImageR
                         ,echelle,ImageA1
                         ,ImageA2
                         ,effacement
                         ,ADRESSE(translation)
                         ,ombres,penombre,ADRESSE(source_lumineuse)
                         ,depth,min_depth_cueing
                         ,avion
                         ,alias
                          )
               );
          SET_FILTRAGE(ACTIF);
          LISTE_BD;
          DEMI_FENETRE_BD(ImageG,ImageR,VRAI,CALCUL_DU_MAXIMUM_DANS_UNE_DEMI_FENETRE);
                                        /* BD : presentation de l'image en montagnes (sens positif)...                               */
          SET_FILTRAGE(INACTIF);
          CALS(Iinit_Z_Buffer());
                                        /* Initialisation du 'Z-Buffer'.                                                             */
          CALS(Imontagnes(ImageR
                         ,NEGA(echelle),ImageA1
                         ,ImageA2
                         ,effacement
                         ,ADRESSE(translation)
                         ,ombres,penombre,ADRESSE(source_lumineuse)
                         ,depth,min_depth_cueing
                         ,avion
                         ,alias
                          )
               );
          SET_FILTRAGE(ACTIF);
          LISTE_BG;
          DEMI_FENETRE_BG(ImageG,ImageR,VRAI,CALCUL_DU_MAXIMUM_DANS_UNE_DEMI_FENETRE);
                                        /* BG : presentation de l'image en montagnes (sens negatif)...                               */
          SET_FILTRAGE(INACTIF);
          CALS(Imove(ImageR,ImageG));
          SET_FILTRAGE(ACTIF);
          MODIFICATION_LISTE_DE_SUBSTITUTION(NOIR,SUCC(NOIR));
          MODIFICATION_LISTE_DE_SUBSTITUTION(BLANC,PRED(BLANC));
                                        /* Afin de reserver le noir et le blanc pour la croix de separation                          */
                                        /* des quatre images.                                                                        */
          SUBSTITUTION(L_SUBSTITUTION_VARIABLE);
          CALS(Imove(ImageG,ImageR));
                                        /* Suppression du BLANC...                                                                   */
          SET_FILTRAGE(INACTIF);
          DECOUPAGE_EN_QUATRE(NOIR,BLANC);
                                        /* Trace d'une croix blanche de separation des quatre images.                                */
          CALi(Iupdate_image(nom_imageR,ImageG));
          Eblock
     ATes
          Bblock
          Test__CODE_ERREUR__ERREUR07;
          Eblock
     ETes

     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.