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;
}