As in this question, I'd like to extract a surface from RegionPlot3D
. Unfortunately, the suggestion to use ContourPlot3D
in that question's comments doesn't work for my actual problem, which is rather involved and has a very steep gradient in the objective function.
Here's a simpler example that demonstrates the same issues as my actual problem:
reg = RegionPlot3D[z < (1 + 0.1 y)/(x + 10^-5), {x, 0, 1}, {y, 0, 20}, {z, 0, 10}]
I'm 99% of the way there, but my solution has some artifacts. My idea was to extract the points as here:
pts = Flatten[Cases[Normal@reg, Line[pts_] :> pts, Infinity], 1];
ListPointPlot3D[pts]
then take the top of each stack of points:
top = GroupBy[pts, Part[#, 1 ;; 2] & -> Last, Max];
ListPointPlot3D[top]
The points look right, but when I try to get the surface with ListPlot3D
there are weird blades I need to get rid of:
ListPlot3D[top, Mesh -> False, PlotStyle -> {Gray, Opacity[0.5]}]
Any ideas on how to either remove those artifacts in ListPlot3D
, or otherwise extract the top surface from RegionPlot3D
?
ImplicitRegion[And[z < (1 + 0.1 y)/(x + 10^-5), 0 <= x <= 1, 0 <= y <= 20, 0 <= z <= 10 ], {x, y, z}] // BoundaryDiscretizeRegion // MeshPrimitives[#, 2] &//RegionUnion
has dimension 2 as checked byRegionDimension
. It does not look exactly like the plot in the image but maybe that is because of the scale. $\endgroup$ImplicitRegion[ And[z < (1 + 0.1 y)/(x + 10^-5), 0 <= x <= 1, 0 <= y <= 20 , 0 <= z <= 10] // Rationalize[#, 0] & // CylindricalDecomposition[#, {x, y, z}, "Boundary"] &, {x, y, z}]
but the region is missing pieces of the original region's surface. $\endgroup$