// Représentation de S4 par action sur un cube

#include "colors.inc"
#include "textures.inc"
#include "shapes.inc"
#include "stones.inc"
#include "woods.inc"                                                
#include "glass.inc"

// ***************************
// Installation de la caméra *
// ***************************
// On installe la caméra et on définit son orientation.
// L'axe des x est vers la droite, l'axe des y vers le haut, l'axe des z vers le fond.


camera {//orthographic
#declare DistanceObservateur = 10;
#declare HauteurObservateur = 5;
#declare Angle = -2;  // pour une vision stéréoscopique :
                     // < 0 pour l'oeil gauche (G.POV) . L'image devra être placée à DROITE en vision croisée
                     // > 0 pour l'oeil droit (D.POV) (en degré), l'image devra être placée à GAUCHE. 
                     // En général 3 à 5 degré d'écart entre les deux yeux. Angle est en degré. 
//Définir l'angle pour choisir l'oeil

location  <DistanceObservateur*cos(Angle/180*pi), HauteurObservateur, DistanceObservateur*sin(Angle/180*3.142)> 
look_at  <0,0,0>
rotate y*225
}

#declare cc=0; 
/* Création d'une animation en 200 images.
créer une image *001.png avec cc=0
copier cette image dans *002.png jusqu'à *025.png
créer les images *026.png jusqu'à *175.png en posant cc=(clock-25)/150 et en faisant varier clock de 26 à 175.
copier l'image *175.png dans *176.png jusqu'à *200.png
*/

// On définit le fond (par défaut noir)

background { color Black}  

// ********
// Objets *
// ********

#declare Rayon = 0.4;
#declare RayonCyl = 0.1;
#declare Cote = 2;
#declare Epsilon = 0.005;

#declare A = <-Cote,-Cote,-Cote>;    
#declare B = <Cote,-Cote,-Cote>;
#declare C = <Cote,Cote,-Cote>;
#declare D = <-Cote,Cote,-Cote>;
#declare E = <-Cote,-Cote,Cote>;    
#declare F = <Cote,-Cote,Cote>;
#declare G = <Cote,Cote,Cote>;
#declare H = <-Cote,Cote,Cote>;

union {
sphere {(1-cc)*A+cc*H Rayon     
        texture {Silver_Metal}
        pigment { color Red }
    }
sphere {(1-cc)*B+cc*G Rayon     
        texture {Silver_Metal}
        pigment { color Blue }
    }
sphere {C Rayon     
        texture {Silver_Metal}
        pigment { color Green }
    }
sphere {D Rayon     
        texture {Silver_Metal}
        pigment { color Yellow }
    }
sphere {E Rayon     
        texture {Silver_Metal}
        pigment { color Green }
    }
sphere {F Rayon     
        texture {Silver_Metal}
        pigment { color Yellow }
    }
sphere {cc*B+(1-cc)*G Rayon     
        texture {Silver_Metal}
        pigment { color Red }
    }
sphere {cc*A+(1-cc)*H Rayon     
        texture {Silver_Metal}
        pigment { color Blue }
    }


cylinder { (1-cc)*A+cc*H (1-cc)*B+cc*G RayonCyl
        texture {Silver_Metal}
        pigment { color White }
    }
cylinder { (1-cc)*B+cc*G C RayonCyl
        texture {Silver_Metal}
        pigment { color White }
    }
cylinder { C D RayonCyl
        texture {Silver_Metal}
        pigment { color White }
    }
cylinder { D (1-cc)*A+cc*H RayonCyl
        texture {Silver_Metal}
        pigment { color White }
    }
cylinder { cc*A+(1-cc)*H E RayonCyl
        texture {Silver_Metal}
        pigment { color White }
    }
cylinder { E F RayonCyl
        texture {Silver_Metal}
        pigment { color White }
    }
cylinder { F cc*B+(1-cc)*G RayonCyl
        texture {Silver_Metal}
        pigment { color White }
    }
cylinder { cc*B+(1-cc)*G cc*A+(1-cc)*H RayonCyl
        texture {Silver_Metal}
        pigment { color White }
    }
cylinder { (1-cc)*A+cc*H E RayonCyl
        texture {Silver_Metal}
        pigment { color White }
    }
cylinder { (1-cc)*B+cc*G F RayonCyl
        texture {Silver_Metal}
        pigment { color White }
    }
cylinder { C cc*B+(1-cc)*G RayonCyl
        texture {Silver_Metal}
        pigment { color White }
    }
cylinder { D cc*A+(1-cc)*H RayonCyl
        texture {Silver_Metal}
        pigment { color White }
    }

polygon {4, C, D, E, F
        pigment {color Col_Aquamarine_01 transmit 0.6}
        }                        

}                               

// *********
// Lumière *
// *********

light_source { <0, 5, 0> color White shadowless}
light_source { <-5, 5, 0> color White shadowless}
light_source { <0, 5, 5> color White shadowless}
