rmholes
Removes holes from a polyshape, leaving solid regions.
Category: Mathematics > Computational Geometry
Syntax
pshape = rmholes(pshape)
Fills every hole.
pshape = rmholes(pshape, I)
Fills only the holes selected by the index I.
Description
A rectangle of area 12 with a unit-square hole has area 11; after rmholes it has area 12 again and NumHoles is 0. The outer boundaries are untouched.
Input arguments
pshape- A
polyshapeobject. I- Index of the holes to fill, counted among the holes only.
Output arguments
pshape- The polyshape with the holes filled in.
Example
Fill the hole of a ring
P = polyshape([0 4 4 0], [0 0 3 3]);
H = polyshape([1 2 2 1], [1 1 2 2]);
D = subtract(P, H);
R = rmholes(D);
[area(D) area(R)]
R.NumHoles
Output
ans = 1×2
11 12
ans = 0