2
$\begingroup$

I'm trying to reproduce this kind of graph for a spherical cap, with different span ratios. I tried with this:

TableForm@
 Table[Table[
   SphericalPlot3D[r, {\[Theta], 0, \[Theta]0}, {\[Phi], 0, 2 Pi}, 
    Boxed -> False], {\[Theta]0, 0.1, Pi/2, Pi/7}], {r, 0.01, 1, 0.2}]

But the result is not what I hoped. Does anyone have some suggestions?

enter image description here

$\endgroup$

1 Answer 1

2
$\begingroup$
surf1[a_, b_] = 
  ContourPlot3D[
   y^2/a^2 + z^2/b^2 == 1, {x, -5, 5}, {y, -5, 5}, {z, -5, 5}, 
   RegionFunction -> 
    Function[{x, y, z}, 
     z^2/b^2 + x^2/a^2 >= 1 && z >= 0 && Abs[x] <= Min[a, b] && 
      Abs[y] <= Min[a, b]], PlotPoints -> 50, 
   RegionBoundaryStyle -> None, Mesh -> None];
surf2[a_, b_] = 
  ContourPlot3D[
   z^2/b^2 + x^2/a^2 == 1, {x, -5, 5}, {y, -5, 5}, {z, -5, 5}, 
   RegionFunction -> 
    Function[{x, y, z}, 
     y^2/a^2 + z^2/b^2 >= 1 && z >= 0 && Abs[x] <= Min[a, b] && 
      Abs[y] <= Min[a, b]], PlotPoints -> 50, 
   RegionBoundaryStyle -> None, Mesh -> None];
surf[a_, b_] := 
  Show[surf1[a, b], surf2[a, b], Boxed -> False, Axes -> False];
surfs = Table[surf[a, b], {a, 3, 5, .5}, {b, 3, 5, .5}];
Graphics3D[
 Table[GeometricTransformation[surfs[[i, j]][[1]], 
   TranslationTransform[15 {i, j, 0}]], {i, 
   Dimensions[surfs][[1]]}, {j, Dimensions[surfs][[2]]}], 
 Boxed -> False, Axes -> {True, True, False}]

enter image description here

$\endgroup$
4
  • $\begingroup$ Thanks a lot for your wonderful example. I'm trying to modify it for a spherical cap, can you give me any suggestions? surf1[a_, b_] = ContourPlot3D[ x^2 + y^2 + z^2 == a/b, {x, -5, 5}, {y, -5, 5}, {z, -5, 5}, RegionFunction -> Function[{x, y, z}, z >= 0], PlotPoints -> 50, Mesh -> None]; surfs = Table[surf1[a, b], {a, 3, 5, .5}, {b, 3, 5, .5}]; Graphics3D[ Table[GeometricTransformation[surfs[[i, j]][[1]], TranslationTransform[5 {i, j, 0}]], {i, Dimensions[surfs][[1]]}, {j, Dimensions[surfs][[2]]}], Boxed -> False, Axes -> {True, True, False}] $\endgroup$
    – Matteo Lai
    Oct 8, 2021 at 8:13
  • $\begingroup$ @MatteoLai Add RegionBoundaryStyle -> None to the surf1[a,b] $\endgroup$
    – cvgmt
    Oct 8, 2021 at 8:43
  • $\begingroup$ RegionBoundaryStyle is a command that is not present in my Mathematica (version: 12). To run your code I must cancel it. Besides, it draws a cylindrical, not a spherical one. $\endgroup$
    – Matteo Lai
    Oct 8, 2021 at 9:36
  • 1
    $\begingroup$ @Matteo Lai that appears to be a separate question entirely that you should ask in a new post, linking to this one if needed; as it stands this question is seemingly answer successfully by this answer. Your Mathematica version is also essential to include in cases when you are not fully updated to the current version. When you ask your new question related to this region boundary problem, that is a necessary piece of information you should include. $\endgroup$ Oct 9, 2021 at 15:01

Your Answer

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

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