4
$\begingroup$

Here's my code

a := -2
q := 1/Sqrt[Abs[a]]
r[u_] = Cosh[q*u]^-a
h[u_] = -(1/q) Integrate[Cosh[q*u]^(-a - 1), u]
m[u_, v_] := r[u] *Cos[v]
k[u_, v_] := r[u]* Sin[v]
FSurface[u_, v_] := {m[u, v], k[u, v], h[u]} 
GGP = ParametricPlot3D[FSurface[u, v], {u, -2 , 2 }, {v, 0, 2 \[Pi]}, 
  BoxRatios -> {3, 3, 3}, PlotPoints -> 50, MaxRecursion -> 0, 
  Mesh -> Full, MeshFunctions -> {#4 + #5 &, #4 - #5 &}, 
  Method -> "BoundaryOffset" -> False, PerformanceGoal -> "Quality"]
(*Delete triangles in the mesh*)
GGPT := DeleteCases[GGP, _Polygon, \[Infinity]]
DiscretizeGraphics[GGPT]

My goal is to plot the surface and then get different meshes of it. Here's the plot and mesh Mathematica generates.

Mesh Along iso-parameter lines

I would like a mesh on the surface that cuts this mesh diagonally. This mean we can just rotate the mesh by 45 degrees. When I do so using MeshFunctions -> {#4 + #5 &, #4 - #5 &}, I get the following: Desired Mesh but with weird behavior around 0, where lines don't meet

The problem with this mesh is that the lines don't meet around 0. Using Mesh -> 50 or any number doesn't fix it because the problem persists and it creates point that aren't vertices.

ugly mesh

This can be fixed using Mesh -> All. However, when I do so, DiscretizeGraphics doesn't work.

A method that I found that generates a good mesh is using Mesh -> Full. It creates a mesh where all the points are vertices as bellow.

nice mesh where the only points are vertices

Basically, I want to DiscretizeGraphics of a mesh which has points only on the vertices. I wish i can use Mesh -> Full and MeshFunctions -> {#4 + #5 &, #4 - #5 &} together and then discretized graphics but they seem to negate each other.

Thank you in advanced for your help

$\endgroup$
3
$\begingroup$

I think it's easier just to program the mesh than to try to get complicated, sophisticated functions like ParametricPlot3D to do something simple. The function sleeveMesh3D creates a 2D, right-triangular mesh of the domain $[0,1]^2$ and applies a function which should be periodic in the first coordinate with period $1$.

sleeveMesh3D // ClearAll;
sleeveMesh3D[f_, m_Integer, n_Integer] := 
  With[{pts = 
     f /@ Tuples@{Most@Subdivide[0, 1, m], Subdivide[0, 1, n]}},
   GraphicsComplex[
    pts,
    Table[
      Line[{
        (n + 1) Mod[i - 1, m] + j, 
        (n + 1) Mod[i, m] + j + 1}],
      {i, 0, m - 1}, {j, n}
      ] ~Join~
     Table[
      Line[{
        (n + 1) Mod[i, m] + j, 
        (n + 1) Mod[i, m] + j + 1}], 
      {i, 0, m - 1}, {j, 1, n}]
    ]
   ];

Example:

With[{i = 24, j = 20},
  Graphics3D[
   sleeveMesh3D[
    FSurface[
      Rescale[#[[2]], {0, 1}, {-2, 2}],
      Rescale[#[[1]] - #[[2]]*j/(2 i), (* rotate each layer *)
       {0, 1}, {0, 2 Pi}]
      ] &, i, j]]
  ] // DiscretizeGraphics

enter image description here

$\endgroup$
2
  • $\begingroup$ Thanks! I never really created a mesh before. I will try to study sleeveMesh3D and figure out exactly what it does. My goal is to create a quad mesh along the asymptotic curves, in this case it's 45 degrees off the iso parameter lines(the ones Mathematica generates). I want to do other mesh parametrization as well. I assume I would only need to modify the rescaling part to change the directions right? Thank you so much for your help! $\endgroup$ – Mhajji Apr 17 at 18:30
  • 1
    $\begingroup$ @Mhajji You're welcome! If you replace the GraphicsComplex[..] with GraphicsComplex[pts, Join[{Blue}, Table[Line[{(n + 1) Mod[i - 1, m] + j, (n + 1) Mod[i, m] + j + 1}], {i, 0, m - 1}, {j, n}], {Red}, Table[Line[{(n + 1) Mod[i, m] + j, (n + 1) Mod[i, m] + j + 1}], {i, 0, m - 1}, {j, 1, n}] ] ] you can see what the two Table commands do. And With[{i = 8, j = 5}, Graphics[sleeveMesh3D[Identity, i, j], PlotRange -> {{0, 1}, {0, 1}}, Frame -> True]] shows what the domain looks like before mapping it onto the hyperboloid. $\endgroup$ – Michael E2 Apr 17 at 20:03

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.