how to export a mesh by convex hull from matlab to cloudcompare
8 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Hi,
i have se following problem.
I have processed a point cloud in Matlab and created a mesh by Alpha shape algorithm.
I want export this one to view in CloudCompare.
I attach my code and a preview of the mesh output.
Thank you so much.
ptCloud=pcread('Pre_potatura_DX_Fila_1_Mare.ply');
pts=double(ptCloud.Location);
shpINT=alphaShape(pts,0.5);
plot(shpINT)
title ('Alpha Shape Intero','FontSize', 14);
xlabel('X', 'FontSize', 14);
ylabel('Y', 'FontSize', 14);
zlabel('Z', 'FontSize', 14);
view(43,16);
0 Kommentare
Antworten (1)
Hornett
am 4 Sep. 2024
I understand you would like to export the alpha shape you created in MATLAB to CloudCompare.
I suggest you refer the following code to export the alphashape to STL file which can be opened in CloudCompare:
% Read the point cloud from a PLY file
ptCloud = pcread('Pre_potatura_DX_Fila_1_Mare.ply');
pts = double(ptCloud.Location);
% Create the alpha shape
shpINT = alphaShape(pts, 0.5);
% Plot the alpha shape
plot(shpINT)
title('Alpha Shape Intero', 'FontSize', 14);
xlabel('X', 'FontSize', 14);
ylabel('Y', 'FontSize', 14);
zlabel('Z', 'FontSize', 14);
view(43, 16);
% Extract boundary facets
[bf, P] = boundaryFacets(shpINT);
% Save the boundary facets to an STL filee
stlwrite(triangulation(bf, P), 'STLfileFromMATLAB.stl');
The `boundaryFacets` function is used to extract the boundary facets from the alpha shape. The resulting boundary facets and their corresponding points are stored in the variables `bf` and `P`, respectively.
Finally, the `stlwrite` function is used to save the boundary facets as an STL file named 'STLfileFromMATLAB.stl'.
Once you have the STL file, you can open it directly in CloudCompare to visualize and work with the mesh.
I hope this helps! Let me know if you have any further questions.
0 Kommentare
Siehe auch
Kategorien
Mehr zu Computational Geometry finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!