// 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 {A Rayon     
        texture {Silver_Metal}
        pigment { color Red }
    }
sphere {B 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 {G Rayon     
        texture {Silver_Metal}
        pigment { color Red }
    }
sphere {H Rayon     
        texture {Silver_Metal}
        pigment { color Blue }
    }


cylinder { A B RayonCyl
        texture {Silver_Metal}
        pigment { color White }
    }
cylinder { B C RayonCyl
        texture {Silver_Metal}
        pigment { color White }
    }
cylinder { C D RayonCyl
        texture {Silver_Metal}
        pigment { color White }
    }
cylinder { D A RayonCyl
        texture {Silver_Metal}
        pigment { color White }
    }
cylinder { H E RayonCyl
        texture {Silver_Metal}
        pigment { color White }
    }
cylinder { E F RayonCyl
        texture {Silver_Metal}
        pigment { color White }
    }
cylinder { F G RayonCyl
        texture {Silver_Metal}
        pigment { color White }
    }
cylinder { G H RayonCyl
        texture {Silver_Metal}
        pigment { color White }
    }
cylinder { A E RayonCyl
        texture {Silver_Metal}
        pigment { color White }
    }
cylinder { B F RayonCyl
        texture {Silver_Metal}
        pigment { color White }
    }
cylinder { C G RayonCyl
        texture {Silver_Metal}
        pigment { color White }
    }
cylinder { D H RayonCyl
        texture {Silver_Metal}
        pigment { color White }
    }

cylinder { Epsilon*D Epsilon*F Cote*6/5
        pigment {color Col_Aquamarine_04 transmit 0.5}
        }
        
cylinder { 3*D 5*F RayonCyl/2
        pigment { color Coral }
        }

rotate -y*45
rotate -x*atan2(1,sqrt(2))/pi*180
rotate z*cc*120
rotate x*atan2(1,sqrt(2))/pi*180      
rotate y*45
}                               

// *********
// Lumière *
// *********

light_source { <0, 10, 0> color White shadowless}
light_source { <10, 0, 0> color White shadowless}
light_source { <0, 0, 10> color White shadowless}
