# Set maximum space between elements in 3D mesh

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

The resulting ListPointPlot3D plot is:

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:

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

• You asked for ConvexHullMesh and you got it. You can of course refine it by applying DiscretizeRegion with a small setting for MaxCellMeasure. Want you obtain is the remeshed convex hull. But maybe you want to compute an $\alpha$-shape? – Henrik Schumacher Jul 4 at 0:36
• In general, it is a very nontrivial problem to construct a mesh from just a point cloud. – Henrik Schumacher Jul 4 at 0:46
• Don't know much about meshing, but I guess I want to compute an alpha shape. How can I do this in Mathematica? – Guillermo Oliver Jul 4 at 12:19
• mathematica.stackexchange.com/a/8812 – Henrik Schumacher Jul 4 at 12:57

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

These two links helped me to solve this problem:

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}];
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];

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