[JAVA2D] Determining if a shape is a hole
I'm using a PathIterator to break up a shape into all of its
consitituent subshapes--where each SET_MOVETO begins a new shape. This
part works fine.
Now I'd like to determine, for each subshape, whether the subshape was
a hole in the original shape.
As a proof of concept, I wrote some code that recursively looks for any
point in the subshape (subshape.contains(x, y)) which is also contained
in the original shape. If none can be found, the shape is a hole. This
gives accurate results, but is very slow when checking holes, because it
ends up checking every point in the subshape down to some granularity.
>From experience I know that in GlyphVectors the "outer" shapes are
always drawn clockwise, and the holes counter-clockwise (a requirement
of the underlying font formats), but obviously this is not true of
shapes in general.
I imagine that to some degree I will have to duplicate the
WIND_EVEN_ODD/WIND_NON_ZERO algorithms, in which case I'd appreciate a
pointer to some Java code, if there is any.
FWIW I need this information to do backface culling when extruding the
shape to a 3d volume.
To unsubscribe, send email to firstname.lastname@example.org and include in the body
of the message "signoff JAVA2D-INTEREST". For general help, send email to
email@example.com and include in the body of the message "help".