//Input: Light list, graphics g and a Lens
        //Output: Change the Light list to the path casued by the lens
        public static void LensAlgoritem(List <Light> lightList, Graphics g, Lens obj)
        {
            try
            {
                Light  last         = lightList[lightList.Count - 1];
                PointF pi           = last.pi;
                PointF pf           = last.pf;
                PointF firstPoint   = new PointF(pi.X, pi.Y);
                Color  lightColor   = last.LightColor;
                double initialAngle = last.GetAngle();

                Region lensReg = obj.GetRegion();
                Region rayReg  = last.GetRegion();


                lensReg.Intersect(rayReg); //Intersect area of lens and the last light
                if (!lensReg.IsEmpty(g))
                {
                    //getting the hit point
                    RectangleF boundsRect = lensReg.GetBounds(g);
                    PointF     hit        = new PointF((boundsRect.Right + boundsRect.Left) / 2, (boundsRect.Top + boundsRect.Bottom) / 2);
                    pf = hit;

                    //creating a light bewtween initial point and hit point
                    lightList[lightList.Count - 1] = new Light(pi, pf, lightColor);

                    pi = pf;

                    Light  light = new Light(pi, pf);
                    double beta  = 0;

                    beta = GetImagePointAngle(g, firstPoint, obj, initialAngle, hit);

                    //creating a light between the hit point and on
                    light = new Light(hit, MathHelper.GetEndLight(hit, beta), lightColor);
                    lightList.Add(light);
                }
            }
            catch
            {
            }
        }