MATLAB Answers

Translated by

このページのコンテンツは英語から自動翻訳されています。自動翻訳をオフにする場合は「<a class="turn_off_mt" href="#">ここ</a>」をクリックしてください。

2

AlphaShape: incorrect geometry

Irene Yang さんによって質問されました 2019 年 3 月 12 日
最新アクティビティ Steven Lord
さんによって コメントされました 2019 年 3 月 12 日
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:
trisurf.PNG
However, this is what I get instead:
alphaShape.PNG
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 件のコメント

Irene Yang 2019 年 3 月 12 日
Hi Sean,
I am aiming to create an alphaShape that I can then use the inshape function to roll a point cloud through and detect "collision". If there is another way to do this "collission detection" I would love to give it a go. From my online search, this is all I could find. Thanks
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.
Irene Yang 2019 年 3 月 12 日
Hi Jan,
My primary goal of using alphaShape is not to obtain a surface but to use the function inshape. However, perhaps I am able to use inshape without creating a surface using alphashape but perhaps using trisurf or trimesh should be sufficient?
My code is very basic:
model=stlread('model.STL');
shp = alphaShape(model.Points(:,1),model.Points(:,2),model.Points(:,3));
plot(shp)
Therefore, I have been using the default values for 'RegionThreshold' (which is 0) or 'HoleThreshold' (which is 0) or 'Alpha' radius (which is the critical radius of 2.5). However, I have tried all alpharadiuses of 0-3 in 0.1 incremements but this still doesnt work as the function alphaShape does not deal well with concave regions and adds in all the additional surfaces.
Thanks

サインイン to comment.

1 件の回答

Sean de Wolski
回答者: Sean de Wolski
2019 年 3 月 12 日
 採用された回答

How about pointlocation?

  2 件のコメント

Irene Yang 2019 年 3 月 12 日
Oh this seems quite promising. I will have a look to see if it can be done in 3D as opposed to the example which is in 2D. Thanks for the suggestion!
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.

サインイン to comment.



Translated by