public void Add(int x, int y, Color color)
        {
            if (_averageColors[y, x] == null)
            {
                _averageColors[y, x] = new AverageColor();
            }

            _averageColors[y, x].Add(color);
        }
        private static unsafe void RenderScanLineDOF(object data)
        {
            RaytracerData raytracerData = data as RaytracerData;

            Random random = new Random();

            for (int x = raytracerData.X0; x < raytracerData.X1; x++)
            {
                AverageColor averageColor = new AverageColor();

                Vector3d focalPoint = raytracerData.Camera.Position + raytracerData.Camera.GetRayDirection(x, raytracerData.Y) * raytracerData.Camera.FocalLength;

                Vector3d ws0 = raytracerData.Camera.ScreenSpaceToWorldSpace(x - 5, raytracerData.Y - 5);
                Vector3d ws1 = raytracerData.Camera.ScreenSpaceToWorldSpace(x + 5, raytracerData.Y + 5);
                //Vector3d ws0 = raytracerData.Camera.ScreenSpaceToWorldSpace(x, raytracerData.Y);
                //Vector3d ws1 = raytracerData.Camera.ScreenSpaceToWorldSpace(x, raytracerData.Y);

                Vector3d range = ws1 - ws0;

                /*
                 * for (int i = 0; i < 32; i++)
                 * {
                 *  double rand = (double)random.NextDouble();
                 *  Vector3d randomPixelWorldSpace = ws0 + rand * range;
                 *  Vector3d rayDirection = (focalPoint - randomPixelWorldSpace).Normalize();
                 *
                 *  IntersectionResult intersectionResult = raytracerData.Scene.GetNearestObjectIntersection(rayDirection, randomPixelWorldSpace);
                 *
                 *  Color color = Color.Black;
                 *
                 *  if (intersectionResult.Object != null)
                 *  {
                 *      color = intersectionResult.Object.GetColor(rayDirection, intersectionResult.Intersection, raytracerData.Scene);
                 *  }
                 *
                 *  bool a = averageColor.Add(color);
                 *
                 *  if (a)
                 *  {
                 *      a = false;
                 *  }
                 * }
                 */

                for (int yy = raytracerData.Y - 3; yy < raytracerData.Y + 3; yy++)
                {
                    for (int xx = x - 3; xx < x + 3; xx++)
                    {
                        Vector3d pixelWorldSpace = raytracerData.Camera.ScreenSpaceToWorldSpace(xx, yy);
                        Vector3d rayDirection    = (focalPoint - pixelWorldSpace).Normalize();

                        //Vector3d raydirection = raytracerData.Camera.GetRayDirection(x, raytracerData.Y);
                        //Vector3d rayposition = raytracerData.Camera.Position;

                        IIntersectionResult intersectionResult = raytracerData.Scene.GetNearestObjectIntersection(rayDirection, pixelWorldSpace);

                        Color color = Color.Black;

                        if (intersectionResult != null)
                        {
                            color = intersectionResult.Object.GetColor(rayDirection, intersectionResult, raytracerData.Scene);
                        }

                        averageColor.Add(color);
                    }
                }


                Color finalColor = averageColor.Color;

                //result.SetPixel(x, y, color);
                byte *pixelPointer = raytracerData.ScanLine + x * 3;

                pixelPointer[0] = finalColor.B;
                pixelPointer[1] = finalColor.G;
                pixelPointer[2] = finalColor.R;
            }
        }