AlphaShape: incorrect geometry
조회 수: 10 (최근 30일)
이전 댓글 표시
Hi,
I have a 3D CAD file which I am importing into Matlab via stlread.
I then use alphaShape using the points generated from stlread of the geometry. However, the alphaShape is not accurate to my geometry and adds a whole bunch of triangles that do not match my geometry.
This is what it is supposed to be:

However, this is what I get instead:

How can I fix this? Does anyone have an idea on how I could possibly go in and edit the triangulation (is this even feasible?)? Or alternatively, another function in matlab that can allow me the same thing as alphaShape? Should I edit the mesh further? I have tried everything that I can think of!
Thanks.
댓글 수: 4
Jan
2019년 3월 12일
편집: Jan
2019년 3월 12일
alphaShape is used to define a surface based on a point cloud. As Sean has written already, you do have a surface already, so there is no need for alphaShape.
But your problem seems to be, that you used inapropriate values for 'RegionThreshold' or 'HoleThreshold' or 'Alpha' radius. Which values did you use? Please post your code.
채택된 답변
Sean de Wolski
2019년 3월 12일
댓글 수: 2
Steven Lord
2019년 3월 12일
See the "Enclosing Tetrahedra" example.
x = gallery('uniformdata',[20 1],0);
y = gallery('uniformdata',[20 1],1);
z = gallery('uniformdata',[20 1],2);
TR = delaunayTriangulation(x,y,z);
P = [0.7 0.6 0.3; 0.5 0.5 0.5];
[ID,B] = pointLocation(TR,P)
I'll plot the delaunayTriangulation using tetramesh and turn off the face colors.
h = tetramesh(TR, 'FaceColor', 'none');
Now I'll add the two points inside.
hold on;
plot3(P(:, 1), P(:, 2), P(:, 3), 'ro', 'MarkerFaceColor', 'r')
Finally I'll color the tetrahedron containing the first point in blue and make it somewhat transparent.
set(h(ID(1)), 'FaceColor', 'b', 'FaceAlpha', 0.25)
If you rotate the axes around you should be able to convince yourself that one of the red dots is inside the blue shape. It looks like it's very close to the surface of the shape but inside.
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Bounding Regions에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!