2
$\begingroup$

I am trying to plot a "wavy" cuboid with a hole in it. The final result does not look great because of jagged edges of the cylindrical hole. Are there any ways to fix it?

I have tried to increase the PlotPoints option to 150 but it is taking nearly a minute without significant improvements.

Is there a smarter way to circumvent this problem?

My code is attached below (MMA 13.1):

RegionPlot3D[z > Sin[x + y^2]/10 && z < 2 + Sin[x + y^2]/10 && (x - 1)^2 + y^2 > 1,
 {x,-5, 5}, {y, -5, 5}, {z, -1, 7}, PlotPoints -> 100, MeshStyle -> None]

Result: enter image description here

$\endgroup$
2

1 Answer 1

1
$\begingroup$

With a restricted z range, I get the following picture:

RegionPlot3D[
 z > Sin[x + y^2]/10 && 
  z < 2 + Sin[x + y^2]/10 && (x - 1)^2 + y^2 > 1, {x, -5, 5}, {y, -5, 
  5}, {z, -0.5, 2.5}, PlotPoints -> 100, MeshStyle -> None]

enter image description here

$\endgroup$
4
  • $\begingroup$ Maybe I am missing the obvious, but isn't the cylindrical hole still jagged in the picture you've attached? Also, I have other elements on my plot (that I have not included), so I would like the z plot range to be a little larger, in case that changes anything. $\endgroup$ Commented Jan 2 at 19:50
  • $\begingroup$ Simply increase PlotPoints. You may increase the z range, this does change nothing essential. $\endgroup$ Commented Jan 2 at 19:59
  • $\begingroup$ Okay, so looks like it means that increasing PlotPoints is the only way to go. (My question specifically asked for ways apart from this approach because it takes more and more time.) $\endgroup$ Commented Jan 2 at 20:07
  • 1
    $\begingroup$ It may be possible to get refinement at the cylinder intersection with BoundaryMeshRegion where you specify finely spaced vertices and edges along the intersections programmatically--or programmatically with a MeshRefinementFunction. It would be tedious. $\endgroup$ Commented Jan 2 at 20:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.