Place secondary polygons (SID
s) identified as holes
(counter-clockwise rotation) under SID
s identified as
solids (clockwise rotation) if the vertices of the holes lie
completely within the vertices of the solids.
This operation is performed for each primary polygon (PID
).
placeHoles(polyset, minVerts=3)
a valid PBSmapping PolySet.
minimum number of vertices required for a polygon representing a hole to be retained (does not affect solids).
Returns the input PolySet where SID
holes have been arranged
beneath appropriate SID
solids for each PID
.
The algorith identifies the rotation of each polygon down to the
SID
level using the PBSmapping function .calcOrientation
,
where output values of 1
= solids (clockwise rotation) and
-1
= holes (counter-clockwise rotation).
Then for each solid, the function tests whether each hole
occurs within the solid.
To facilitate computation, the algorithm assumes that once a
hole is located in a solid, it will not occur in any other solid.
This means that for each successive solid, the number of
candidate holes will either decrease or stay the same.
This function makes use of the point.in.polygon
function
contained in the package sp. For each hole vertex, the latter
algorithm returns a numeric value:
0
= hole vertex is strictly exterior to the solid;
1
= hole vertex is strictly interior to the solid;
2
= hole vertex lies on the relative interior of an edge of the solid;
3
= hole vertex coincides with a solid vertex.
See copyright notice in point.in.polygon
.