boundaryFacets
Boundary edges (2-D) or faces (3-D) of an alpha shape.
Category: Mathematics > Computational Geometry
Syntax
bf = boundaryFacets(shp)
Returns the boundary facets as rows of point indices.
[bf, P] = boundaryFacets(shp)
Also returns the point coordinates the indices refer to.
Description
A facet is on the boundary when it belongs to only one simplex of the alpha triangulation. The function lists those facets for the current Alpha, which is what is needed to draw the outline or to build a mesh of the surface.
For 2-D shapes the edges can be chained to recover the polygon.
Input arguments
shp- An
alphaShapeobject.
Output arguments
bf- Two columns per edge for a 2-D shape, three per triangular face for a 3-D shape.
P- The points of the shape, one per row.
Example
Outline edges of a square
x = [0 1 1 0 0.5]';
y = [0 0 1 1 0.5]';
shp = alphaShape(x, y, 1);
[bf, P] = boundaryFacets(shp)
Output
bf = 4×2
1 2
2 3
3 4
4 1
P = 4×2
0 0
1 0
1 1
0 1