volume
Volume of 3-D alpha shape
Description
Examples
Find Volume of 3-D Alpha Shape
Create a set of 3-D points.
[x1, y1, z1] = sphere(24);
x1 = x1(:);
y1 = y1(:);
z1 = z1(:);
x2 = x1+5;
P = [x1 y1 z1; x2 y1 z1];
P = unique(P,'rows');
Create and plot an alpha shape using an alpha radius of 1.5.
shp = alphaShape(P,1.5); plot(shp)
Compute the volume of the alpha shape.
totalvol = volume(shp)
totalvol = 8.2468
Compute the volumes of each of the two regions separately.
regionvols = volume(shp, 1:numRegions(shp))
regionvols = 1×2
4.1234 4.1234
Input Arguments
shp
— 3-D alpha shape
alphaShape
object
3-D alpha shape, specified as an alphaShape
object. For
more information, see alphaShape
Example: shp = alphaShape(x,y,z)
creates a 3-D
alphaShape
object from the (x,y,z)
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
Open Example
You have a modified version of this example. Do you want to open this example with your edits?
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
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)