static void DrawFastPixel(int x, int y, MyColor c)
        {
            unsafe
            {
                c.Check();
                c.To255(out byte RR, out byte VV, out byte BB);

                byte *ptr = (byte *)data.Scan0;
                ptr[(x * 3) + y * stride]     = BB;
                ptr[(x * 3) + y * stride + 1] = VV;
                ptr[(x * 3) + y * stride + 2] = RR;
            }
        }
        static void DrawSlowPixel(int x, int y, MyColor c)
        {
            Color cc = c.Convert();

            B.SetPixel(x, y, cc);

            Program.MyForm.PictureBoxInvalidate();
            currentRate++;
            if (currentRate > refreshRate)  // force l'affichage à l'écran tous les 1000pix
            {
                Program.MyForm.PictureBoxRefresh();
                currentRate = 0;
            }
        }
        public static void Display()
        {
            var camera       = new V3(WindowWidth / 2, -WindowWidth, WindowHeight / 2);
            var sceneObjects = GetSceneObjects();
            var sceneLights  = GetSceneLights();

            for (int xScreen = 0; xScreen <= WindowWidth; xScreen++)
            {
                for (int yScreen = 0; yScreen <= WindowHeight; yScreen++)
                {
                    V3      currentPixelPosition = new V3(xScreen, 0, yScreen);
                    V3      rayDirection         = currentPixelPosition - camera;
                    MyColor PixelColor           = Screen.RayCast(camera, rayDirection, sceneObjects, sceneLights, REFLEXION_NUMBER, REFRACTION_NUMBER);
                    Screen.DrawPixel(xScreen, yScreen, PixelColor);
                }
            }
        }
        public static void DrawPixel(int x, int y, MyColor c)
        {
            int x_ecran = x;
            int y_ecran = Hauteur - y;

            if ((x_ecran >= 0) && (x_ecran < Largeur) && (y_ecran >= 0) && (y_ecran < Hauteur))
            {
                if (DisplayMode == DisplayMode.SLOW_MODE)
                {
                    DrawSlowPixel(x_ecran, y_ecran, c);
                }
                else
                {
                    DrawFastPixel(x_ecran, y_ecran, c);
                }
            }
        }
 static public void RefreshScreen(MyColor c)
 {
     if (!Program.MyForm.FastMode())
     {
         DisplayMode = DisplayMode.SLOW_MODE;
         Graphics g  = Graphics.FromImage(B);
         Color    cc = c.Convert();
         g.Clear(cc);
     }
     else
     {
         DisplayMode = DisplayMode.FULL_SPEED;
         data        = B.LockBits(new Rectangle(0, 0, B.Width, B.Height), ImageLockMode.ReadWrite, PixelFormat.Format24bppRgb);
         stride      = data.Stride;
         for (int x = 0; x < Largeur; x++)
         {
             for (int y = 0; y < Hauteur; y++)
             {
                 DrawFastPixel(x, y, c);
             }
         }
     }
 }
 /// <summary>
 /// Permet de copier une couleur
 /// </summary>
 /// <param name="color">La couleur a copier</param>
 public MyColor(MyColor color)
 {
     Red   = color.Red;
     Green = color.Green;
     Blue  = color.Blue;
 }
 /// <summary>
 /// Permet de transposer une couleur
 /// </summary>
 /// <param name="objectTarget">L objet couleur qu on veut utiliser</param>
 /// <param name="color">La couleur qu on souhaite obtenir</param>
 static public void Transpose(ref MyColor objectTarget, Color color)
 {
     objectTarget.Red   = (float)(color.R / 255.0);
     objectTarget.Green = (float)(color.G / 255.0);
     objectTarget.Blue  = (float)(color.B / 255.0);
 }
 /// <summary>
 /// Constructeur de la classe
 /// </summary>
 /// <param name="pointA">Le point A</param>
 /// <param name="pointB">Le point B</param>
 /// <param name="pointC">Le point C</param>
 /// <param name="shapeColor">La color d objet</param>
 public Parallelogram(V3 pointA, V3 pointB, V3 pointC, MyColor shapeColor, bool ignoreShadow, Texture textureBump = null, float intensiteBump = 0, float coefReflexion = 0, float coefRefraction = 0, float indiceFresnel = 0) : base(shapeColor, textureBump, intensiteBump, coefReflexion, coefRefraction, indiceFresnel)
 {
     InitPoints(pointA, pointB, pointC);
     this.ignoreShadow = ignoreShadow;
 }
 /// <summary>
 /// Constructeur d une sphere avec coordonnees
 /// </summary>
 /// <param name="x"></param>
 /// <param name="y"></param>
 /// <param name="z"></param>
 /// <param name="radius"></param>
 /// <param name="shapeColor"></param>
 public Sphere(float x, float y, float z, int radius, MyColor shapeColor, Texture textureBump = null, float intensiteBump = 0, float coefReflexion = 0, float coefRefraction = 0, float indiceFresnel = 0) : this(new V3(x, y, z), radius, shapeColor, textureBump, intensiteBump, coefReflexion, coefRefraction, indiceFresnel)
 {
 }
 /// <summary>
 /// Constructeur d une sphere
 /// </summary>
 /// <param name="center">Le point du centre</param>
 /// <param name="radius">Le rayon de la sphere</param>
 /// <param name="shapeColor">La couleur de la sphere</param>
 public Sphere(V3 center, int radius, MyColor shapeColor, Texture textureBump = null, float intensiteBump = 0, float coefReflexion = 0, float coefRefraction = 0, float indiceFresnel = 0) : base(shapeColor, textureBump, intensiteBump, coefReflexion, coefRefraction, indiceFresnel)
 {
     InitPoints(center, radius);
 }