boundary
Boundary of a set of 2-D or 3-D points, between the convex hull and a tight outline.
Category: Mathematics > Computational Geometry
Syntax
k = boundary(x, y)
Indices of the points on the boundary of 2-D points, with the default shrink factor 0.5.
k = boundary(x, y, s)
Uses the shrink factor s between 0 and 1.
k = boundary(P)
Points given as the rows of a matrix with two or three columns.
[k, v] = boundary(___)
Also returns the area (2-D) or volume (3-D) enclosed.
Description
boundary returns a polygon around the points that can be concave, unlike convhull. The shrink factor decides how closely the outline follows the points: with 0 the result equals the convex hull, and larger values let it enter concave notches.
The points are returned as indices into the input rather than coordinates, so [x(k) y(k)] gives the outline's vertices.
Input arguments
x, y- Column vectors of point coordinates.
s- Shrink factor.
0gives the convex hull and1the most compact boundary.
Output arguments
k- Column vector of point indices. In 2-D it traces the polygon and the first index is repeated at the end.
v- Area or volume of the region.
Example
Concave outline versus convex hull
x = [0 2 2 1 1 0 0.5 1.5 0.5 0.5]';
y = [0 0 1 1 2 2 0.5 0.5 1.5 1.0]';
k0 = boundary(x, y, 0)'
[k1, v] = boundary(x, y, 1);
k1'
v
Output
k0 = 1×6
1 2 3 5 6 1
ans = 1×9
1 7 8 2 3 5 6 10 1
v = 2.2500