Dear George, Greg,
Thank you both for your feedback, most helpful!
One alternative approach would be to cut the outer polygon apart
instead of keeping it intact. Just sort the corner points of all
the holes eg. vertically, and make a horizontal cut at each
height. You need to be careful to combine equal hights (allow for
some numeric rounding error), and not to cut through tall holes
sitting next to short ones. This method should work particularly
well if the wall and hole polygons are orthogonal to each other,
which happens to often be the case in architectural models.
George,
The solution proposed by the author of the python Polygon package does
exactly this; the complex polygon is split into a list of simple polygons,
using the center of gravity of the polygon. After the split it isn't
difficult to write it out to a .rad format!
Maybe I'm being naive, but I've had good luck creating connecting seams
between arbitrary vertices in holey polygons. Make sure the outer
vertices are in counter-clockwise order around the normal, and the
interior (hole) vertices are clockwise. Then, the algorithm goes
something like this:First N vertices are N vertices of outer contour
Next M1 vertices are M1 vertices of hole 1
Close hole loop with vertex that is copy of the first hole
vertex
Close seam by adding copy of last outer contour vertex
Repeat 3 steps above for each hole contourIn Radiance, polygon seams can cross all over each other and it doesn't
create any artifacts. This is how fonts are rendered, for example.
This is also why I never bothered implementing holes in polygons; I
never found where seams caused a problem, and I couldn't think of any
way besides seams for implementing holes.-Greg
Greg,
Thanks for the sketched out algorithm, I was hoping for that kind of
response! By no means was my mail intended as criticism for the lack of
explicit holes, just hoping for a way to get passed the problem!
I'm sure your suggested algorithm will be helpful in further development of
my project.
Cheers,
Jelle.