Simple case (works here)
If no mesh of the surface is ever parallel to the x,y or z plane then one can utilize the VertexNormals option for light shading to obtain the normals of the meshes in the x,y or z plane and remove. These normals look like {0,0,1}, {0,-1,0}, {0,1,0} etc but as floating point real numbers. Hence, we may remove them like this :
(Note the usage of Normal below to convert the GraphicsComplex structure into an ordinary list of graphics primitives and directives to facilitate pattern matching)
(p[[2]] below has the form VertexNormals-> {values__} ) :
Normal@reg /. p_Polygon :> Nothing /; AllTrue[p[[2, 2]], MatchQ[Abs@Rationalize[#], {OrderlessPatternSequence[0, 1, 0]}] &] That works except maybe if one explicitly changes the VertexNormals option via NormalsFunction or something.
More complicated scenario with piecewise constant surfaces (not the case here)
If the surface does have meshes that are parallel to the x, y or z plane then the direction of normals is not enough and one has to use the coordinates of these planes. Such a scenario is likely rare unless one has a piece wise function or a bad mesh but for completeness a code for such a scenario is included below.
The code below takes as argument a polygon poly and a couple {n,val} where n=1,2 or 3 for x,y or z and val is the constant value taken on the plane:
withinPlane[couple_][poly_] := AllTrue[Rationalize[poly[[1]], 0], #[[couple[[1]] ]] == couple[[2]] &]; Then one may remove the meshes belonging to planes at the boundaries of the plot:
Normal@reg /. p_Polygon :> Nothing /; Or @@ Through@{withinPlane[{1, 0}], withinPlane[{1, 1}], , withinPlane[{2, 0}], withinPlane[{2, 20}], withinPlane[{3, 0}], withinPlane[{3, 10}]}@p Which leads to the same plot above.
