private bool IsSurfaceInPlane(Surface surface, Plane plane, double tolerance)
 {
   if (!surface.IsPlanar(tolerance))
     return false;
  
   var bbox = surface.GetBoundingBox(true);
   return bbox.GetCorners().All(
     corner => System.Math.Abs(plane.DistanceTo(corner)) <= tolerance);
 }