split triangles on overlap

I have a triangle (red, below). (or a 2D mesh of triangles)

How can I compute the polygons (and in turn tessellate them) that result from subtracting a second triangle (green) from the first?

enter image description here

(I'm using Python and I'm looking for an explanation and pseudo-code of an approach I can take, rather than recommendations for opaque libraries. (I currently use gluTess*() to do the tessellation of polygons, but an explanation of how to do the tesselltation myself would be interesting; my pressing problem is really the Boolean operation itself though.) It will be exciting to learn and understand the solution. My triangles are always counter-clockwise winding, if that makes any difference.)

6
задан Will 14 April 2011 в 18:13
поделиться