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

42 views (last 30 days)
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!

Accepted Answer

Image Analyst
Image Analyst on 26 Nov 2024 at 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 Comment
Alessio
Alessio on 27 Nov 2024 at 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!

Sign in to comment.

More Answers (0)

Products


Release

R2017a

Community Treasure Hunt

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

Start Hunting!