Esempio n. 1
0
            internal double TraceRay(Ray ray, Vector light)
            {
                IntersectionPoint p = Intersect(ray,
                                                new IntersectionPoint(
                                                    double.PositiveInfinity, new Vector(0.0, 0.0, 0.0)));

                if (double.IsInfinity(p.distance))
                {
                    return(0.0);
                }

                double greyscale = -(p.normal * light);

                if (greyscale <= 0.0)
                {
                    return(0.0);
                }

                Vector o = ray.origin +
                           (p.distance * ray.direction) + (Epsilon * p.normal);

                Ray shadowRay             = new Ray(o, new Vector(0.0, 0.0, 0.0) - light);
                IntersectionPoint shadowp = Intersect(shadowRay,
                                                      new IntersectionPoint(double.PositiveInfinity, p.normal));

                return(double.IsInfinity(shadowp.distance) ? greyscale : 0.0);
            }
Esempio n. 2
0
 override internal IntersectionPoint Intersect(Ray r, IntersectionPoint p)
 {
     if (bound.Distance(r) < p.distance)
     {
         foreach (Scene each in scenes)
         {
             p = each.Intersect(r, p);
         }
     }
     return(p);
 }
Esempio n. 3
0
            override internal IntersectionPoint Intersect(Ray r, IntersectionPoint p)
            {
                double d = Distance(r);

                if (d < p.distance)
                {
                    Vector v = r.origin + ((d * r.direction) - center);
                    p = new IntersectionPoint(d, v.Normalized());
                }
                return(p);
            }
Esempio n. 4
0
			abstract internal IntersectionPoint Intersect (Ray ray, IntersectionPoint p);
Esempio n. 5
0
			override internal IntersectionPoint Intersect (Ray r, IntersectionPoint p)
			{
				if (bound.Distance (r) < p.distance) { 
					foreach (Scene each in scenes)
						p = each.Intersect (r, p);
				}
				return p;
			}
Esempio n. 6
0
			override internal IntersectionPoint Intersect (Ray r, IntersectionPoint p)
			{
				double d = Distance (r);
				if (d < p.distance) { 
					Vector v = r.origin + ((d * r.direction) - center);
					p = new IntersectionPoint (d, v.Normalized ());
				}
				return p;
			}
Esempio n. 7
0
 abstract internal IntersectionPoint Intersect(Ray ray, IntersectionPoint p);