#!/bin/csh

#######################################################################################################################################
#                                                                                                                                     #
#         P E R I O D I S A T I O N   E T   S Y M E T R I S A T I O N   H O R I Z O N T A L E S                                       #
#         D ' U N E   I M A G E   E N   V U E   D E   F A I R E   D E S   A U T O S T E R E O G R A M M E S  :                        #
#                                                                                                                                     #
#                                                                                                                                     #
#         Utilisation :                                                                                                               #
#                                                                                                                                     #
#                   $xci/periodise.01$Z <imageA> <imageR> [<Periode> [<Horizontal>]]                                                  #
#                                                                                                                                     #
#                                                                                                                                     #
#         Author of '$xci/periodise.01$Z' :                                                                                           #
#                                                                                                                                     #
#                     Jean-Francois Colonna (LACTAMME, 20030613155003).                                                               #
#                                                                                                                                     #
#######################################################################################################################################

set       imageA=$1
set       imageR=$2
set       Periode=$3
set       Horizontal=$4

setArgum  Periode                       `$xci/stereogra.01$X Parametres=VRAI |& $GRE "periode_a_forcer=" | $SE -e 's/^.* \([^ ][^ ]*\)$/\1/'`

setArgum  Horizontal                    $EXIST

if        ($Horizontal == $EXIST) then
          set       Symetrie=$xci/Sy$X
          set       Move="xR=$Periode thR=VRAI"
                                        # Cas d'une periodisation et symetrisation horizontales.                                      #
else
          set       Symetrie=$xci/Sx$X
          set       Move="yR=$Periode tvR=VRAI"
                                        # Cas d'une periodisation et symetrisation horizontales.                                      #
endif

FileTmpB  ImageT1
FileTmpB  ImageT2
                                        # Definition des images temporaires...                                                        #

$Symetrie                                                                                                                               \
                    A=$imageA                                                                                                           \
                    R=$ImageT1                                                                                                          \
                                                                                                              $formatI

set       Coincidences=`$xci/coincidences$X A1=$imageA A2=$ImageT1 $formatI Prme=VRAI`
                                        # Afin de voir si les images '$imageA' et '$ImageT1' sont identiques...                       #

if        ($Coincidences == $tailleI) then
                                        # Cas ou l'image '$imageA' possede deja la symetrie '$Symetrie' :                             #
          $xci/neutre$X                                                                                                                 \
                              A$imageA                                                                                                  \
                              R=$ImageT1                                                                                                \
                                                                                                              $formatI
else
                                        # Cas ou l'image '$imageA' ne possede pas encore la symetrie '$Symetrie' :                    #
          $xci/minmax$X                                                                                                                 \
                              A1=$imageA                                                                                                \
                              A2=$ImageT1                                                                                               \
                              R=$ImageT1                                                                                                \
                                                                                                              $formatI
endif

$xci/init$X                                                                                                                             \
                    n=$NOIR                                                                                                             \
                    R=$ImageT2                                                                                                          \
                                                                                                              $formatI

set       Nombre=`$xcg/INVZ.01$X x=$Periode signe="$K_VIDE" entier=VRAI`

set       Index=$Nombre

while     ($Index != 0)
          $xci/minmax$X                                                                                                                 \
                              A1=$ImageT2                                                                                               \
                              A2=$ImageT1                                                                                               \
                              R=$ImageT2                                                                                                \
                                                                                                                        $formatI
          $xci/move$X                                                                                                                   \
                              A=$ImageT1                                                                                                \
                              $Move                                                                                                     \
                              R=$ImageT1                                                                                                \
                                                                                                                        $formatI

          @         Index = $Index - 1
end

$xci/acces$X                                                                                                                            \
                    A=$ImageT2                                                                                                          \
                    renormaliser=VRAI                                                                                                   \
                    R=$imageR                                                                                                           \
                                                                                                              $formatI

FileTmpE  ImageT1
FileTmpE  ImageT2



Copyright © Jean-François Colonna, 2019-2021.
Copyright © CMAP (Centre de Mathématiques APpliquées) UMR CNRS 7641 / Ecole Polytechnique, 2019-2021.