Fractrace.PictureArt.FastPreviewRenderer.IsInSharpShadow C# (CSharp) Method

IsInSharpShadow() protected method

Test, if the given point is inside the sharp shadow. Returns the number of intersection with the ray and the fractal, but not more than maxIntersections.
protected IsInSharpShadow ( Fractrace.Geometry.Vec3 point, Fractrace.Geometry.Vec3 ray, double rayLenght, bool inverse, int maxIntersections, int steps ) : int
point Fractrace.Geometry.Vec3
ray Fractrace.Geometry.Vec3
rayLenght double
inverse bool
maxIntersections int
steps int
return int
        protected int IsInSharpShadow(Vec3 point, Vec3 ray, double rayLenght, bool inverse, int maxIntersections, int steps)
        {
            //int steps = 100;
            inverse = false;
            double dSteps = steps;
            double dist = 0;
            int shadowCount = 0;
            for (int gSteps = 0; gSteps < 6; gSteps++)
            {
                dist = rayLenght / dSteps;
                Vec3 currentPoint = new Vec3(point);
                currentPoint.Add(ray.Mult(dist));
                for (int i = 0; i < steps; i++)
                {
                    currentPoint.Add(ray.Mult(dist));
                    if (formula.TestPoint(currentPoint.X, currentPoint.Y, currentPoint.Z, inverse))
                    {
                        shadowCount++;
                        if (shadowCount >= maxIntersections)
                            return maxIntersections;
                    }
                    else
                    {
                        //  return false;
                    }
                }
                rayLenght /= 1.4;
            }
            return shadowCount;
        }