public override Ray ReflectedRay(Ray Ray_) { if (!Reflective) { return(null); } if (Ray_.ReflectingEnergy == 0) { return(null); } PointF Source = this.Cast(Ray_); if (Source == Ray_.InfPoint()) { return(null); } foreach (var Side in Sides) { PointF CastPoint = Side.Cast(Ray_); if (Source == CastPoint) { return(Side.ReflectedRay(Ray_)); } } // code never reaches here! return(null); }
public override PointF Cast(Ray Ray_) { PointF CastPoint = Ray_.InfPoint(); double best = Utility.oo; foreach (var Side in Sides) { PointF CastTemp = Side.Cast(Ray_); double DisTemp = Utility.Distance(CastTemp, Ray_.Source); if (DisTemp < best) { CastPoint = CastTemp; best = DisTemp; } } return(CastPoint); }