private Point Shade(ISect isect) // находим естественный цвет пикселя { var pos = isect.Dist * isect.Ray.Dir + isect.Ray.Start; //точка пересечения var normal = isect.Thing.normal(pos); var reflectDir = isect.Ray.Dir - (2 * (normal * isect.Ray.Dir) * normal); Point result = background_color; result += GetNaturalColor(isect.Thing, pos, normal, reflectDir); return(result); }
private Point TraceRay(Ray ray) // точка откуда и направление { var isects = Intersections(ray); ISect isect = isects.FirstOrDefault(); if (isect == null) { return(background_color); } return(Shade(isect)); }
private double TestRay(Ray ray) // объект между светом и точкой { var isects = Intersections(ray); ISect isect = isects.FirstOrDefault(); if (isect == null) { return(0); } return(isect.Dist); }