#!/bin/csh

#######################################################################################################################################
#                                                                                                                                     #
#         G E N E R A T I O N   D E   L A   P A L E T T E   ' Impossible.01 '  :                                                      #
#                                                                                                                                     #
#                                                                                                                                     #
#         Utilisation :                                                                                                               #
#                                                                                                                                     #
#                   $xigP/Impossible.01$Z         [<FichiersXYZ> [<Message> [<TailleMessage> [<DimensionXY> [<Bibliotheque>]]]]]      #
#                                                                                                                                     #
#                                                                                                                                     #
#         Author of '$xigP/Impossible.01$Z' :                                                                                         #
#                                                                                                                                     #
#                     Jean-Francois COLONNA (LACTAMME, 20230504095112).                                                               #
#                                                                                                                                     #
#######################################################################################################################################

set       FichiersXYZ=$1
set       Message=$2
set       TailleMessage=$3
set       DimensionXY=$4
set       Bibliotheque=$5

setArgum  Message             "AJ332JA"
setArgum  TailleMessage       86
setArgum  DimensionXY         `calculINS (2*6*$TailleMessage)-2`
                                        # Le "2*6" vient du fait qu'il y a deux caracteres "AJ" (et "JA") dans le message et qu'ils   #
                                        # sont inscrits dans un carre 6x6. Je ne vois pas comment automatiser cela facilement...      #
setArgum  Bibliotheque        3
                                        # Argument introduit le 20230524090630...                                                     #

FilSTmpB  FStRuCtUrE

#20230505092438____:XYmaxNe   `calcul $XmaxSud+1` `calcul $YmaxSud+1`                                                                 #
#20230506100806____:XYmaxNe   `calcul $XmaxStd+1` `calcul $YmaxStd+1`                                                                 #

XYmaxNe   $DimensionXY $DimensionXY
                                        # Et ce afin qu'existe un "vrai" point entier au milieu de [$Xmin,$Xmax] et [$Ymin,$Ymax].    #
                                        #                                                                                             #
                                        # On notera avec le message par defaut "AJ332JA", les couples suivants :                      #
                                        #                                                                                             #
                                        #                   TailleMessage :     DimensionXY :                                         #
                                        #                                                                                             #
                                        #                        86                  1030                                             #
                                        #                        43                   514                                             #
                                        #                        22                   262                                             #
                                        #                                                                                             #
                                        # Je ne vois pas comment automatiser cela facilement...                                       #

set       OrIgInE_X=`$xci/coordonnees$X abscisse=VRAI ordonnee=FAUX normalisees=VRAI x=1 signe="$K_VIDE"`
set       OrIgInE_Y=`$xci/coordonnees$X abscisse=FAUX ordonnee=VRAI normalisees=VRAI y=1 signe="$K_VIDE"`
                                        # Cela est destine a garantir que les structures de type "AJ332JA" se raccordent a            #
                                        # elles-memes correctement (sans decalage...) lors de symetries par rapport a 'OX' et 'OY'.   #

$xci/message$X                                                                                                                          \
                    A=$NOIR                                                                                                             \
                    taille=$TailleMessage                                                                                               \
                    SKH=FAUX                                                                                                            \
                    message="$Message"                                                                                                  \
                    bibliotheque=$Bibliotheque                                                                                          \
                    x=-$OrIgInE_X                                                                                                       \
                    y=-$OrIgInE_Y                                                                                                       \
                    R=$FStRuCtUrE.image                                                                                                 \
                                                                                                                        $formatI

if        ($NEXIST) then
                                        # Possibilite mise en place le 20230506100806...                                              #
          $xci/display$X                                                                                                                \
                              A=$FStRuCtUrE.image                                                                                       \
                                                                                                                        $formatI  &

          $xci/Sx$X                                                                                                                     \
                              A=$FStRuCtUrE.image                                                                                       \
                                                                                                                        $formatI  |     \
          $xci/display$X                                                                                                                \
                              xc=1 yc=0                                                                                                 \
                                                                                                                        $formatI  &

          $xci/Sy$X                                                                                                                     \
                              A=$FStRuCtUrE.image                                                                                       \
                                                                                                                        $formatI  |     \
          $xci/display$X                                                                                                                \
                              xc=0 yc=1                                                                                                 \
                                                                                                                        $formatI  &
else
endif

$xci/liste_points$X                                                                                                                     \
                    A=$FStRuCtUrE.image                                                                                                 \
                    fond=$NOIR                                                                                                          \
                    lister_fond=FAUX                                                                                                    \
                    eX=VRAI eY=VRAI eNIVEAU=FAUX                                                                                        \
                    epoints=FAUX                                                                                                        \
                    Prme=VRAI                                                                                                           \
                                                                                                                        $formatI  |     \
$xcp/substitue.01$X                                                                                                                     \
                    c01="x\(=\)"        s01="X\1"                                                                                       \
                    c02="\ny\(=\)"      s02=" Y\1"                                                                                      \
                                                                                                    >   $FStRuCtUrE.all

$CA       $FStRuCtUrE.all                                                                                                         |     \
$GRE      -v '^ *$'                                                                                                               |     \
$SE       -e "s/X=//" -e "s/Y=//"                                                                                                       \
                                                                                                    >>  $FStRuCtUrE
                                        # Le '$SOR' est destine a trier les 'X's par ordre croissant...                               #

set       SeLeCtIoN="$K_VIDE"

if        ("$FichiersXYZ" == "$K_VIDE") then
                                        # Test introduit le 20230428112853...                                                         #
          set       SeLeCtIoN="$SeLeCtIoN"" $xrv/selection.11$X"
          set       SeLeCtIoN="$SeLeCtIoN"" nombre=`calcul $COULEURS`"

          set       PaSsEs=10
else
          set       SeLeCtIoN="$SeLeCtIoN"" $xrv/neutre$X"

          set       PaSsEs=0
endif

set       MiNiMuM=0
set       MaXiMuM=1

$CA       $FStRuCtUrE                                                                                                             |     \
$AW       ' { print $1 } '                                                                                                        |     \
$SeLeCtIoN                                                                                                                              \
          ne=0 fichier==                                                                                                          |     \
$xrv/lissage.01$X                                                                                                                       \
          ne=0 fichier==                                                                                                                \
          passes=$PaSsEs                                                                                                          |     \
$xrv/normalise.01$X                                                                                                                     \
          ne=0 fichier==                                                                                                                \
          minimum=$MiNiMuM    maximum=$MaXiMuM                                                                                          \
                                                                                                    >   $FStRuCtUrE.9$COORD_X

$CA       $FStRuCtUrE                                                                                                             |     \
$AW       ' { print $2 } '                                                                                                        |     \
$SeLeCtIoN                                                                                                                              \
          ne=0 fichier==                                                                                                          |     \
$xrv/lissage.01$X                                                                                                                       \
          ne=0 fichier==                                                                                                                \
          passes=$PaSsEs                                                                                                          |     \
$xrv/normalise.01$X                                                                                                                     \
          ne=0 fichier==                                                                                                                \
          minimum=$MiNiMuM    maximum=$MaXiMuM                                                                                          \
                                                                                                    >   $FStRuCtUrE.9$COORD_Y

$CA       $FStRuCtUrE                                                                                                             |     \
$AW       ' { print "0" } '                                                                                                       |     \
$SeLeCtIoN                                                                                                                              \
          ne=0 fichier==                                                                                                          |     \
$xrv/normalise.01$X                                                                                                                     \
          ne=0 fichier==                                                                                                                \
          minimum=$MiNiMuM    maximum=$MaXiMuM                                                                                          \
                                                                                                    >   $FStRuCtUrE.9$COORD_Z

if        ("$FichiersXYZ" == "$K_VIDE") then
          $CA       $FStRuCtUrE.9$COORD_X                                                                                         |     \
          $xrv/normalise.01$X                                                                                                           \
                    ne=0 fichier==                                                                                                      \
                    minimum=$NOIR maximum=$BLANC                                                                                        \
                    formater=VRAI entier=VRAI signe="$K_VIDE"                                                                           \
                                                                                                              >   $FStRuCtUrE$COORD_X

          $CA       $FStRuCtUrE.9$COORD_Y                                                                                         |     \
          $xrv/normalise.01$X                                                                                                           \
                    ne=0 fichier==                                                                                                      \
                    minimum=$NOIR maximum=$BLANC                                                                                        \
                    formater=VRAI entier=VRAI signe="$K_VIDE"                                                                           \
                                                                                                              >   $FStRuCtUrE$COORD_Y

          $CA       $FStRuCtUrE.9$COORD_Z                                                                                         |     \
          $xrv/normalise.01$X                                                                                                           \
                    ne=0 fichier==                                                                                                      \
                    minimum=$NOIR maximum=$BLANC                                                                                        \
                    formater=VRAI entier=VRAI signe="$K_VIDE"                                                                           \
                                                                                                              >   $FStRuCtUrE$COORD_Z

          set       VaLide_X=`$CA $FStRuCtUrE$COORD_X | $WCl`
          set       VaLide_Y=`$CA $FStRuCtUrE$COORD_Y | $WCl`
          set       VaLide_Z=`$CA $FStRuCtUrE$COORD_Z | $WCl`

          if        (($VaLide_X == $COULEURS) && ($VaLide_Y == $COULEURS) && ($VaLide_Z == $COULEURS)) then
     set  numeros   = (`$xci/valeurs_inte$X p=$NOIR d=$BLANC vD=$NOIR_PLANCHER vA=$COULEURS cubique=FAUX entiers=VRAI signe="$K_VIDE"`)
     set  niveaux   = (`$xci/valeurs_inte$X p=$NOIR d=$BLANC vD=$NOIR          vA=$BLANC    cubique=FAUX entiers=VRAI signe="$K_VIDE"`)
     set  fonction  = (`repeat $COULEURS echo "N "`)
                    set       rouge     = (`$CA $FStRuCtUrE$COORD_X`)
                    set       verte     = (`$CA $FStRuCtUrE$COORD_Y`)
                    set       bleue     = (`$CA $FStRuCtUrE$COORD_Z`)

                    source    $xigP/.INTERPOLE$Y
          else
                    EROR      "Il n'a pas ete possible de generer '$COULEURS' niveaux."
          endif
else
          set       ChIfFrEs=4

          $DELETE   $FichiersXYZ$COORD_X
          $CA       $FStRuCtUrE.9$COORD_X                                                                                         |     \
          $xrv/normalise.01$X                                                                                                           \
                    ne=0 fichier==                                                                                                      \
                    minimum=0     maximum=1                                                                                             \
                    ChiffresFlot=$ChIfFrEs                                                                                              \
                                                                                                              >   $FichiersXYZ$COORD_X

          $DELETE   $FichiersXYZ$COORD_Y
          $CA       $FStRuCtUrE.9$COORD_Y                                                                                         |     \
          $xrv/normalise.01$X                                                                                                           \
                    ne=0 fichier==                                                                                                      \
                    minimum=0     maximum=1                                                                                             \
                    ChiffresFlot=$ChIfFrEs                                                                                              \
                                                                                                              >   $FichiersXYZ$COORD_Y

          $DELETE   $FichiersXYZ$COORD_Z
          $CA       $FStRuCtUrE.9$COORD_Z                                                                                         |     \
          $xrv/normalise.01$X                                                                                                           \
                    ne=0 fichier==                                                                                                      \
                    minimum=0     maximum=1                                                                                             \
                    ChiffresFlot=$ChIfFrEs                                                                                              \
                                                                                                              >   $FichiersXYZ$COORD_Z
endif

FilSTmpE  FStRuCtUrE



Copyright © Jean-François COLONNA, 2023-2024.
Copyright © CMAP (Centre de Mathématiques APpliquées) UMR CNRS 7641 / École polytechnique, Institut Polytechnique de Paris, 2023-2024.