perimeter
Perimeter length of a polyshape or a 2-D alpha shape.
Category: Mathematics > Computational Geometry
Syntax
L = perimeter(pshape)
Total length of all boundaries, holes included.
L = perimeter(pshape, I)
Perimeter of only the boundaries selected by I.
L = perimeter(shp)
Perimeter of a 2-D alphaShape. For a 3-D one use surfaceArea.
Description
The perimeter is the sum of the edge lengths along every boundary. A hole contributes its own boundary length, since it is also an edge of the shape. A 4 by 3 rectangle has perimeter 14; carving a unit square hole raises it to 18.
Input arguments
pshape- A
polyshapeobject. shp- A 2-D
alphaShape.
Output arguments
L- Scalar length, in the units of the coordinates. An empty shape has perimeter
0.
Example
Perimeter with and without a hole
P = polyshape([0 4 4 0], [0 0 3 3]);
H = polyshape([1 2 2 1], [1 1 2 2]);
D = subtract(P, H);
perimeter(P)
perimeter(D)
Output
ans = 14
ans = 18