public double Intersect(Ray3D ray) { var d = this.Plane().Intersect(ray); var bary = this.ToBarycentric(ray.PointAt(d)); if (bary.X < 0.0 || bary.Y < 0.0 || bary.Z < 0.0) { return(double.PositiveInfinity); } return(d); }