area
Area of 2-D alpha shape
Description
Examples
Find Area of 2-D Alpha Shape
Create a set of 2-D points.
th = (pi/12:pi/12:2*pi)'; x1 = [reshape(cos(th)*(1:5), numel(cos(th)*(1:5)),1); 0]; y1 = [reshape(sin(th)*(1:5), numel(sin(th)*(1:5)),1); 0]; x = [x1; x1+15;]; y = [y1; y1];
Create and plot an alpha shape using an alpha radius of 2.5.
shp = alphaShape(x,y,2.5); plot(shp)
Compute the area of the alpha shape.
totalarea = area(shp)
totalarea = 155.2914
Compute the areas of each of the two regions separately.
regionareas = area(shp, 1:numRegions(shp))
regionareas = 1×2
77.6457 77.6457
Input Arguments
shp
— Alpha shape
alphaShape
object
Alpha shape, specified as an alphaShape
object.
For more information, see alphaShape
.
Example: shp = alphaShape(x,y)
creates a 2-D alphaShape
object
from the (x,y)
point coordinates.
RegionID
— ID number for a region in the alpha shape
positive integer scalar
ID number for region in alpha shape, specified as a positive
integer scalar between 1
and numRegions(shp)
.
An alpha shape can contain several smaller regions, depending
on the point set and parameters. Each of these smaller regions is
assigned a unique RegionID
, which numbers the regions
from the largest area or volume to the smallest. For example, consider
a 3-D alpha shape with two regions. The region with the largest volume
has a RegionID
of 1, and the smaller region has
a RegionID
of 2.
Example: shp.RegionThreshold = area(shp,numRegions(shp)-2);
suppresses
the two smallest regions in 2-D alpha shape shp
.
Data Types: double
Version History
Introduced in R2014b
See Also
Ouvrir l'exemple
Vous possédez une version modifiée de cet exemple. Souhaitez-vous ouvrir cet exemple avec vos modifications ?
Commande MATLAB
Vous avez cliqué sur un lien qui correspond à cette commande MATLAB :
Pour exécuter la commande, saisissez-la dans la fenêtre de commande de MATLAB. Les navigateurs web ne supportent pas les commandes MATLAB.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)