alphaShape

Creates a bounding region around a set of 2-D or 3-D points, controlled by a radius alpha.

Category: Mathematics > Computational Geometry

Syntax

shp = alphaShape(x, y)

Builds a 2-D alpha shape from column vectors of coordinates, using the default alpha.

shp = alphaShape(x, y, z)

Builds a 3-D alpha shape.

shp = alphaShape(P)

Takes the points as the rows of the matrix P (two or three columns).

shp = alphaShape(___, alpha)

Sets the alpha radius explicitly.

Description

An alpha shape generalizes the convex hull. A disc (or ball) of radius alpha is imagined rolling around the point set, and the shape is what the points enclose without the disc fitting through gaps. With a large alpha the result is the convex hull; reducing alpha lets the boundary cut into concave parts and even split into several regions.

The object can be queried with functions such as area, perimeter, inShape, numRegions, criticalAlpha and boundaryFacets. The Alpha property can be reassigned to change the shape afterwards.

Input arguments

x, y, z
Coordinates of the points, as column vectors of equal length.
P
Matrix with one point per row.
alpha
Non-negative scalar radius. Small values give a tight, possibly fragmented shape; very large values give the convex hull.

Output arguments

shp
An alphaShape object with properties Points, Alpha, HoleThreshold and RegionThreshold.

Example

Alpha shape of a square with a center point

x = [0 1 1 0 0.5]';
y = [0 0 1 1 0.5]';
shp = alphaShape(x, y, 1);
disp(area(shp))
disp(perimeter(shp))
disp(numRegions(shp))
Output
     1
     4
     1

See also

boundary convhull criticalAlpha inShape delaunayTriangulation