5

I'd like to plot polygons with holes on a framework that doesn't support holes. The approach to me seems to be to translate the single polygon into several ones adding up to the whole polygon, leaving out the holes.

Is there a standard algorithm for that? Maybe even with code? Or is there another standard way to solve the problem of plotting polygons with holes?

1 Answer 1

2

A standard way to do that is the following: If the polygon external ring is composed of n points (P1,P2,...,Pn,P1) and a hole internal ring of m points (H1,H2,...,Hm,H1), try to draw the polygon composed of the single following external ring: (P1,P2,...,Pn,P1,H1,H2,...,Hm,H1,P1). This is equivalent of drawing a fictive imperceptible corridor between the external and internal ring like there:

enter image description here

It can be generalised in case of several holes: (P1,P2,...,Pn,P1, H11,H12,...,H1m1,H21,H11, H21,H22,...,H2m2,H21, ... , P1)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.