10
$\begingroup$

I would like to create a boundary mesh of the following ellipsoid, whose thickness is modulated along its long axis:

Enter image description here

The surface parametrization I used for it is:

{a, b, c} = {2, 5, 10};
s[\[Theta]_, \[Phi]_] := {a (1.2 - Sin[\[Theta]]), b (1.2 - Sin[\[Theta]]), c}*{Cos[\[Phi]] Sin[\[Theta]], Sin[\[Phi]] Sin[\[Theta]], Cos[\[Theta]]};
ParametricPlot3D[
 s[\[Theta], \[Phi]], {\[Theta], 0, \[Pi]}, {\[Phi], 0, 2 \[Pi]},
 Boxed -> False, Axes -> False, PlotRange -> All]

A simple meshing attempt is:

dr = DiscretizeRegion[ParametricRegion[s[\[Theta], \[Phi]], {{\[Theta], 0 \[Pi], \[Pi]}, {\[Phi], 0, 2 \[Pi]}}]]
ToBoundaryMesh[dr]["Wireframe"]

However, that leads to a triangulation problem at either pole ($\theta = 0 \lor \theta=\pi$):

Enter image description here

Taking a step back and trying to mesh a simple ellipsoid seems to work well using the in-built Ellipsoid and ImplicitRegion functions:

ToBoundaryMesh[
  DiscretizeGraphics[Ellipsoid[{0, 0, 0}, {a, b, c}],
   MaxCellMeasure -> 0.001]]["Wireframe"]

Enter image description here

\[ScriptCapitalR] =
  ImplicitRegion[(x/a)^2 + (y/b)^2 + (z/c)^2 == 1, {x, y, z}];
ToBoundaryMesh[
  DiscretizeRegion[\[ScriptCapitalR], MaxCellMeasure -> 0.1,
   Axes -> True]]["Wireframe"]

Enter image description here

But it also fails for the ParametricPlot3D version:

DiscretizeGraphics[
 ParametricPlot3D[{a, b, c}*{Cos[\[Phi]] Sin[\[Theta]],
    Sin[\[Phi]] Sin[\[Theta]], Cos[\[Theta]]}, {\[Theta],
   0.0 \[Pi], \[Pi]}, {\[Phi], 0, 2 \[Pi]}]]

Enter image description here


How can I get rid of the meshing problem at the poles?

$\endgroup$
3
  • $\begingroup$ What is a "French biscuit"? A ladyfinger? $\endgroup$ – Peter Mortensen Sep 5 '20 at 18:58
  • $\begingroup$ Yes. Thanks for extending my english candy vocabulary ;) $\endgroup$ – Oscillon Sep 5 '20 at 19:02
  • 1
    $\begingroup$ Then you may like this list. $\endgroup$ – Peter Mortensen Sep 5 '20 at 19:04
10
$\begingroup$

Manually derived implicit region:

Block[{a, b, c},
 {a, b, c} = {2, 5, 10};
 DiscretizeRegion[
  ImplicitRegion[(25 c^2 (b^2 x^2 + a^2 y^2))/(
    a^2 b^2 (c^2 - z^2) (6 - 5 Sqrt[1 - z^2/c^2])^2) == 
    1, {{x, -a, a}, {y, -b, b}, {z, -c, c}}],
  MaxCellMeasure -> "Length" -> 0.1]
 ]

enter image description here


Addendum: Alternative method.

reg = DiscretizeRegion[Sphere[], MaxCellMeasure -> "Length" -> 0.05];
Block[{a, b, c},
 {a, b, c} = {2, 5, 10};
 MeshRegion[
  s[##2] & @@@ 
   CoordinateTransform["Cartesian" -> "Spherical", 
    MeshCoordinates@reg.RotationMatrix[1.^-8, {1., 1., 1.}]], 
  MeshCells[reg, 2]]
 ]

The cells of the mesh get deformed by the transformation s[], so it is probably not as good as the above. On the other hand, you don't need to eliminate the parameters from the parametrization s[], which might be difficult in other cases.

$\endgroup$
4
  • 1
    $\begingroup$ Solve the x and y coordinates for sine and cosine of phi. The the sum of the squares is 1, and this eliminates phi. Then solve the z coordinate for cosine of theta and eliminate theta. $\endgroup$ – Michael E2 Sep 5 '20 at 1:05
  • $\begingroup$ Can one say that in general, it is better to use ImplicitRegion than polar 2d parametrizations? Is there a (simple) way to transform the crappy mesh (singularity at pole) from the polar parametrization into a nice mesh? $\endgroup$ – Oscillon Sep 5 '20 at 18:57
  • 1
    $\begingroup$ @Oscillon (1) I would think so, because a (triangulated) rectangular grid is mapped onto the closed surface. (2) Not that I know of. $\endgroup$ – Michael E2 Sep 5 '20 at 19:02
  • 1
    $\begingroup$ @Oscillon I added a parametric alternative that has a couple of restrictions. The surface must be parametrized over a sphere. And the cells cannot be refined where needed to make a smooth surface; one might be able to use the MeshRefinementFunction option to refine the sphere where needed (maybe in ToElementMesh[] since I can't get it to work in DiscretizeRegion). $\endgroup$ – Michael E2 Sep 5 '20 at 19:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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