criticalAlpha

Smallest alpha at which an alpha shape meets a connectivity criterion.

Category: Mathematics > Computational Geometry

Syntax

a = criticalAlpha(shp, type)

Returns the critical alpha for the criterion type.

Description

Alpha shapes with tiny alpha fall apart and drop points; with a large alpha they become the convex hull. The critical alpha is the threshold between those, found among the values of alphaSpectrum. A common use is to set shp.Alpha = criticalAlpha(shp, 'one-region') to get the tightest shape that stays in one piece.

Input arguments

shp
An alphaShape object.
type
'all-points' (every point is part of the shape) or 'one-region' (the shape is a single region).

Output arguments

a
Scalar alpha value.

Example

Tightest one-piece shape

x = [0 1 1 0 0.5]';
y = [0 0 1 1 0.5]';
shp = alphaShape(x, y);
a = criticalAlpha(shp, 'one-region')
shp.Alpha = a;
disp(numRegions(shp))
Output
a = 0.5000
     1

See also

alphaShape alphaSpectrum numRegions inShape