alphaShape

Polygons and polyhedra from points in 2-D and 3-D

Description

An alphaShape creates a bounding area or volume that envelops a set of 2-D or 3-D points. You can manipulate the alphaShape object to tighten or loosen the fit around the points to create a nonconvex region. You can also add or remove points or suppress holes or regions.

After you create an alphaShape object, you can perform geometric queries. For example, you can determine if a point is inside the shape or find the number of regions that make up the shape. You can also calculate useful quantities like area, perimeter, surface area, or volume and plot the shape for visual inspection.

Create Object

Create an alphaShape using the alphaShape function.

Properties

expand all

Coordinates of points, specified as a matrix with two or three columns (for 2-D or 3-D point sets). These points are initially used to create the alpha shape, excluding duplicates.

Data Types: double

Alpha radius, specified as a nonnegative scalar. The alpha radius is the radius of the alpha disk or sphere which sweeps over the points to create the alpha shape.

The default alpha radius is a = criticalAlpha(shp,'all-points'), which is the smallest alpha radius that produces an alpha shape enclosing all points. Specify a = criticalAlpha(shp,'one-region') to use the smallest alpha radius that produces an alpha shape with only one region.

The extreme values of Alpha:

  • If Alpha is Inf, then alphaShape produces the convex hull.

  • If Alpha is 0, then the resulting alphaShape is empty.

Data Types: double

Maximum area or volume of interior holes or voids to fill in, specified as a finite nonnegative scalar.

  • For 2-D, HoleThreshold specifies the maximum area of interior holes to fill in.

  • For 3-D, HoleThreshold specifies the maximum volume of interior voids to fill in. Holes extending completely through the 3-D alpha shape cannot be filled in.

The default value is 0, so that alphaShape does not suppress any holes or voids. The application of the HoleThreshold and RegionThreshold properties is order-dependent. alphaShape fills in holes before suppressing regions.

Data Types: double

Maximum area (2-D) or volume (3-D) of regions to suppress, specified as a finite nonnegative scalar.

The default value is 0, so that alphaShape does not suppress any regions. The application of the HoleThreshold and RegionThreshold properties is order-dependent. alphaShape fills in holes before suppressing regions.

Data Types: double

Object Functions

alphaSpectrum Alpha values giving distinct alpha shapes
criticalAlpha Alpha radius defining a critical transition in the shape
numRegions Number of regions in alpha shape
inShape Determine if point is inside alpha shape
alphaTriangulation Triangulation that fills alpha shape
boundaryFacets Boundary facets of alpha shape
perimeter Perimeter of 2-D alpha shape
area Area of 2-D alpha shape
surfaceArea Surface area of 3-D alpha shape
volume Volume of 3-D alpha shape
plot Plot alpha shape
nearestNeighbor Determine nearest alpha shape boundary point

Examples

expand all

This example shows how to change an alpha shape object and compute useful quantities that describe the alpha shape.

Create and plot a set of 2-D points.

x = gallery('normaldata',50,1,1);
y = gallery('normaldata',50,1,2);
plot(x,y,'.')

Create and plot an alpha shape using an alpha radius of 0.7.

shp = alphaShape(x,y,0.7);
plot(shp)

Change the alpha radius to 0.5 to tighten the boundary around the set of points.

shp.Alpha = 0.5;
plot(shp)

Query the number of regions that make up the new alpha shape.

numRegions(shp)
ans =

     2

Suppress the smaller of the two regions.

shp.RegionThreshold = 1;
plot(shp)

Compute the perimeter and area of the remaining region.

regionperims = perimeter(shp)
regionareas = area(shp)
regionperims =

   11.8543


regionareas =

    4.5407

See Also

Introduced in R2014b

Was this topic helpful?