rmboundary

Removes selected boundaries from a polyshape.

Category: Mathematics > Computational Geometry

Syntax

pshape = rmboundary(pshape, I)

Deletes the boundaries whose indices are in I.

Description

Boundaries are numbered in the order of the Vertices list, which is also the order used by ishole and sortboundaries. Use sortboundaries first when you want to remove, for example, the smallest piece.

Removing the outer boundary of a region also removes the holes inside it.

Input arguments

pshape
A polyshape object.
I
Index or vector of indices of the boundaries to delete, counted in the order they appear in Vertices.

Output arguments

pshape
The polyshape without those boundaries.

Example

Drop the second island

P = polyshape([0 4 4 0], [0 0 3 3]);
B = addboundary(P, [5 6 6 5], [0 0 1 1]);
area(B)
R = rmboundary(B, 2);
area(R)
Output
ans = 13
ans = 12

See also

addboundary sortboundaries ishole rmholes numboundaries