Extra faces when going from point cloud to stl file

19 views (last 30 days)
Hello everyone,
I'm trying to make a propeller generator that can export a stl file. I make the propeller as a point cloud then I use the alphaShape, boundaryFacets, and stlwrite functions to export the point cloud to an .stl file. Like the following (the cloud varaible is my point cloud):
shp = alphaShape(cloud', 0.0497); % 0.0497 comes from using the criticalAlpha function on shp
[bf, P] = boundaryFacets(shp);
stlwrite(triangulation(bf, P), 'test2.stl', 'text');
But when I open the generated .stl file, there are some extra faces added around the base of the blade. Below is the exported .stl file in PrusiaSlicer, with the added faces circled.
For referance a plot of the point cloud I created is attached.
I will admit that I have no idea how the alphashape, boundarFacets, and stlwrite functions work. I'm just looking for a way to get rid of the extra faces around the base of the blades. I've tried playing around with the alpha radius but I don't really know what it does so I didn't get any significant results.
Does anyone know how to get rid of these extra faces or a better way to go from a point cloud to a .stl file?
Thanks in advance!

Answers (1)

Aritra
Aritra on 2 Feb 2023
Hi,
As per my understanding you are trying to convert a point cloud to a .stl file. You have tried using the alphaShape(x,y,z), boundaryFacets(shp), and stlwrite(TR,filename,fileformat) functions. However, the generated results had extra faces involved.
As an alternate solution you can try using the delaunay(x,y,z) function. The Delaunay function creates a 3D Delaunay triangulation from points in a point cloud. You can check the comments section of the following ML answer to learn more about how to convert 3D co-ordinates to stl surfaces using Delaunay triangulation function.
Similarly, you can use the boundary(x,y,z) function which takes a point cloud as an input and returns a solid formed by them. You can also visualize the results of the graph generated by the boundary(x,y,z) function using the trisurf(T,x,y,z) function. You can check the comments section of the following ML answer to learn more about how to convert point clouds to Mesh/Grid to STL.
Finally, you can use the stlwrite(TR,filename) function to generate the final STL file.
For more details you can refer to the following documentation on Delaunay, stlwrite, trisurf and boundary function:

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!