Mathematica Stack Exchange is a question and answer site for users of Mathematica. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Data :

 data3D = Import[file, "VertexData"];

enter image description here

How to find concave polygon for separated small clusters.

share|improve this question
Have you already explored the earlier question Finding a Concave Hull? – Joseph O'Rourke Jul 28 '12 at 0:24
@JosephO'Rourke That question came from the same poster – Dr. belisarius Jul 28 '12 at 3:44
up vote 8 down vote accepted

The procedure I suggested for your other "concave hull" question seems to work reasonably well here, simultaneously isolating the clusters and creating the surfaces.

Norm[a.a Cross[b,c]+b.b Cross[c,a]+c.c Cross[a,b]]/(2Norm[a.Cross[b,c]])];



enter image description here

Cluster colouring

The clusters using this method are just sets of connected polygons. We can build a graph of these connections and use ConnectedComponents to find the individual clusters. This allows such things as colouring the clusters for easier visualisation.




enter image description here

share|improve this answer

As I said before, there really isn't such a thing as a concave hull. What you want to do is plot your clusters here.

The first problem involves a machine vision problem known as 3D segmentation. Mathematica doesn't have any tools out of the box to do this, as far as I know.

One way is to guess how many "clusters" are in your data, although that's hard to say because it appear to be sort of fractal. You should experiment with heuristics for doing this.

I guessed about 40 for your data:


data3D = Import["", 

cls = FindClusters[data3D, 40];

      GraphicsComplex[#1, Polygon[TetGenConvexHull[#1]]]}] &) /@ cls]

Clustered Data

You might also try a different metric, although it makes clustering slower:

cls = FindClusters[data3D, 40, DistanceFunction -> ManhattanDistance];

      GraphicsComplex[#1, Polygon[TetGenConvexHull[#1]]]}] &) /@ cls]

Clustered Using Manhattan Distance

If you want something besides the convex hull for each cluster, you might try adapting an answer to Finding a Concave Hull.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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