2

A region in 3D space has been discretized to obtain a list of points.

The resulting ListPointPlot3D plot is:

enter image description here

I will like to obtain a mesh from these points, but the mesh should not connect points that are too far away from each other.

Using ConvexHullMesh and BoundingRegion directly gives the following result:

enter image description here

The mesh connects points that are far away, closing a part of the volume which must be concave. Is there a way to set the maximum distance between the nodes of the mesh?

The list of 3D points is available at: Points

Guillermo Oliver
  • 459
  • 2
  • 11

1 Answers1

1

Thank you for pointing me in the right direction, Henrik Schumacher!

These two links helped me to solve this problem:

Finding a concave hull

Random discrete data 3D plot

Adequately modifying this code by Taiki and Simon Woods was just what I needed:

tetrahedra = Level[MeshPrimitives[DelaunayMesh[data], 3], {-3}];
radius[p_] := Circumsphere[p][[2]];
radii = radius /@ tetrahedra;
alphashape[rmax_] := Pick[tetrahedra, radii, r_ /; r < rmax]
faces[tetras_] := Flatten[
   tetras /. {a_, b_, c_, d_} :> {{a, b, c}, {a, b, d}, {a, c, d}, {b, c, d}}, 1];
externalfaces[faces_] := Cases[Tally[Sort /@ faces], {face_, 1} :> face];
radiusmax = 150;
polys = externalfaces@faces@alphashape[radiusmax];
Graphics3D[
  {EdgeForm[{Thin, Opacity[1/30, Black]}], Polygon@polys},
  AxesLabel -> {"x", "y", "z"},
  Axes -> True,
  Boxed -> False,
  BoxRatios -> {1, 1, 1},
  ViewPoint -> 1000 {-1, 1, -1}
]

The result is: enter image description here

Further playing with the rmax parameter can yield even more refined results.

Guillermo Oliver
  • 459
  • 2
  • 11