Beispiel #1
0
        Hit IShape.Intersect(Ray ray)
        {
            double step = 1.0 / 32;
            bool   sign = Contains(ray.Position(step));

            for (double t = step; t < 12; t += step)
            {
                Vector v = ray.Position(t);
                if (Contains(v) != sign && Box.Contains(v))
                {
                    return(new Hit(this, t - step, null));
                }
            }
            return(Hit.NoHit);
        }