How to find the optimal parameters for alphaShape?
조회 수: 4 (최근 30일)
이전 댓글 표시
I have a STL file for which I want to generate a tetrahedral mesh. I know there's already a function for this in the PDE toolbox and most of the time it works well, but sometimes it does not accept the STL file (various errors, I won't go into details, that's beside the point. It's also slow for large parts).
More importantly, you cannot view the soruce code of generateMesh. So I'm not sure how MATLAB is handling the whole thing.
Anyway I had this idea:
1) I will create point clouds from the STL (at the moment I'm doing this out of MATLAB, if you have any idea how this could be handled within MATLAB, that would be great).
2) Then use alphaShape to generate the mesh. (Delaunary triagnulation doesn't work well for complex shapes with lots of holes)
Somewhat successful, but as I play with different parameters, I cannot seem to be able to get the right balance.
shp = alphaShape(points); %points is Nx3 data from the 3D cloud points
shp.Alpha = 3; %I have been experimenting mainly with this parameter
tri = alphaTriangulation(shp);
pdemesh(shp.Points',tri')
Alpha radius from left to right is 1.5, 2, 3 and 10. As you see, when it's small, you can see all the fine details of the part, but at the same time there are many "gaps". As I increase the radius, these gaps are filled, but the part also loses its details. The edges merge and the smaller holes completely vanish.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/836010/image.png)
This is how the STL file look like:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/836015/image.png)
Any thoughts? There's probably a more robust approach for this that would be independent from the geometry. For instance, is there a way to first generate a triangular surface mesh to establish the edges (from the point clouds alone, there's no connectively list) and only then convert it to a solid tetrahedral mesh?
댓글 수: 2
Steven Lord
2021년 12월 16일
I have a STL file for which I want to generate a tetrahedral mesh. I know there's already a function for this in the PDE toolbox and most of the time it works well, but sometimes it does not accept the STL file (various errors, I won't go into details, that's beside the point. It's also slow for large parts).
Would it be possible for you to send a sample STL file for which the functions in Partial Differential Equations Toolbox throw errors or perform slowly to Technical Support for investigation of the cause of those errors or slow performance?
I looked through the bug reports for this product. There was a bug where importGeometry crashed for STL files with invalid triangles, but that has been fixed in release R2021b. I don't see anything else that from your brief description sound relevant.
답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Geometry and Mesh에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!