public bool IsShadowed(Tuple point, Tuple light) { Tuple v = light - point; double distance = Tuple.Magnitude(v); Tuple direction = Tuple.Normalize(v); Ray r = new Ray(point, direction); List <Intersection> intersections = IntersectWorld(r); Intersection h = Intersection.Hit(intersections); if (h is not null && h.T < distance) { return(true); }
public Color ColorAt(Ray r, int remaining) { List <Intersection> xs = IntersectWorld(r); Intersection i = Intersection.Hit(xs); if (i is null) { return(new Color(0, 0, 0)); } else { Computations comps = Computations.PrepareComputations(i, r, xs); return(ShadeHit(comps, remaining)); } }