Extract border points from surface points (compatible with autogeneration in C)

42 ビュー (過去 30 日間)
Alessio
Alessio 2024 年 11 月 26 日 10:30
コメント済み: Alessio 2024 年 11 月 27 日 11:20
Hello everyone! I am working in MatLab r2017a and I am doing some geometrical computations. I got all the points of a surface with which I am working in x and y coordinates. I am trying to extract only the points of the border of this surface, but I can't use MatLab functions that are not compatible with autogeneration in C and I also have to use only fixed-size variables. I already tried to extract them using a local search for extremes in x and y but it doesn't work properly. Can you help me finding a way to implement this?
This is an example of the kind of surface points I get. There are some regions with denser points because this is the result of the projection of a 3D surface in a 2D plane that should represents my FOV.
I hope someone will help me find a solution! Thanks a lot in advance!

採用された回答

Image Analyst
Image Analyst 2024 年 11 月 26 日 18:03
help alphaShape
alphaShape - Polygons and polyhedra from points in 2-D and 3-D An alphaShape creates a bounding area or volume that envelops a set of 2-D or 3-D points. Creation Syntax shp = alphaShape(x,y) shp = alphaShape(x,y,z) shp = alphaShape(P) shp = alphaShape(___,a) shp = alphaShape(___,Name,Value) Input Arguments x - x-coordinates column vector y - y-coordinates column vector z - z-coordinates column vector P - Point coordinates matrix with two columns | matrix with three columns a - Alpha radius nonnegative scalar Name-Value Arguments HoleThreshold - Maximum interior holes 0 (default) | finite, nonnegative scalar RegionThreshold - Maximum regions 0 (default) | finite, nonnegative scalar Properties Points - Coordinates of points matrix Alpha - Alpha radius nonnegative scalar HoleThreshold - Maximum interior holes 0 (default) | finite nonnegative scalar RegionThreshold - Maximum regions 0 (default) | finite nonnegative scalar Object Functions numRegions - Number of regions in alpha shape area - Area of 2-D alpha shape perimeter - Perimeter of 2-D alpha shape surfaceArea - Surface area of 3-D alpha shape volume - Volume of 3-D alpha shape boundaryFacets - Boundary facets of alpha shape alphaTriangulation - Triangulation that fills alpha shape inShape - Determine if point is inside alpha shape alphaSpectrum - Alpha values giving distinct alpha shapes criticalAlpha - Alpha radius defining critical transition in shape nearestNeighbor - Determine nearest alpha shape boundary point plot - Plot alpha shape Examples openExample('matlab/AlphaShapeFrom2DPointCloudExample') openExample('matlab/AlphaShapeFrom3DPointCloudExample') openExample('matlab/FillHolesIn2DAlphaShapeExample') openExample('matlab/DiscardSmallRegionsOf3DAlphaShapeExample') openExample('matlab/ModifyPointsOf2DAlphaShapeExample') See also convhull, boundary, delaunayTriangulation, triangulation, trisurf, criticalAlpha Introduced in MATLAB in R2014b Documentation for alphaShape doc alphaShape
th = (pi/12:pi/12:2*pi)';
x1 = [reshape(cos(th)*(1:5), numel(cos(th)*(1:5)),1); 0];
y1 = [reshape(sin(th)*(1:5), numel(sin(th)*(1:5)),1); 0];
x = [x1; x1+15];
y = [y1; y1];
plot(x,y,'.')
axis equal
shp = alphaShape(x,y);
plot(shp)
If you have any more questions, then attach your data and code to read it in with the paperclip icon after you read this:
  1 件のコメント
Alessio
Alessio 2024 年 11 月 27 日 11:20
Ouch, sorry if I didn't follow the rules for writing questions. I haven't attached my data and code because it consists only of a surface generation and projection in the new reference frame in the present state.
Thanks a lot for the answer, it would work normally but unluckily alphaShape is not compatible with autogeneration in C.
I will keep looking for alternative solutions!

サインインしてコメントする。

その他の回答 (0 件)

製品


リリース

R2017a

Community Treasure Hunt

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

Start Hunting!

Translated by