I have set of 3D data points in the form of a .csv file. I import this file into Mathematica as such:

data = Import["C:\\Users\\username\\Desktop\\project\\data.csv"];

enter image description here

and when I use ListPointPlot3D to visualize them, I get the following image


enter image description here

But I need to form the 3D solid region that is formed by these points. I neeed a smooth 3D solid.

How can I go about creating that image?

Note: For those who are interested, here is the data: github link

data = Import["https://raw.githubusercontent.com/gunsuer/mathematica_data/main/dat9.csv"];
NonConvexHullMesh = ResourceFunction["NonConvexHullMesh"];
mesh = NonConvexHullMesh[data, .05];
Show[mesh, ListPointPlot3D[data]]


Your data is very flat. You might want to try PCA and rescaling to get it a more solid looking mesh you can manipulate afterwards:

pcad = Standardize@PrincipalComponents[data];
mesh = NonConvexHullMesh[pcad, .7];
Show[mesh, ListPointPlot3D[pcad]]

pca mesh

  • $\begingroup$ Looks perfect, but I came across an error while introducing NonConvexHullMesh. It says "Privilege violation for file or directory" $\endgroup$
    – 123456
    Apr 24 at 13:06
  • $\begingroup$ @jah you probably don't have permission to download resource functions to the usual directory. Look up this error on this site. $\endgroup$
    – flinty
    Apr 24 at 13:09
  • $\begingroup$ OK I got it working, but how can I make this transparent. Because I also have to plot data with shapes similar to the one above, inside one another? $\endgroup$
    – 123456
    Apr 24 at 13:31
  • $\begingroup$ @jah do something like Graphics3D[{EdgeForm[None], GrayLevel[.7], Opacity[.05], mesh, Opacity[1], ... <other primitives> ...}] - that said transparency doesn't work that well - I'd recommend exporting the model and working in Blender. $\endgroup$
    – flinty
    Apr 24 at 13:36
  • $\begingroup$ I see. How can I export this to blender? $\endgroup$
    – 123456
    Apr 24 at 13:51

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.