Search code examples
contourtriangulationglyph

Is there an algorithm for triangulating contors that overlap


I am trying to triangulate some vector data for rendering SVG graphics on to the screen usingopengl, for data that has contors that don't overlap I can triangulate and render these shapes ok but there are cases where contors do overlap and this is where I am having issues.

I currently use a delaunay triangulation algorithm and the data I am using is true type font data. For reference the character I am looking at is (char)260 of the arial font. I enclose a picture from font forge showing the shape.

enter image description here

I can successfully "fill" this shape in using the winding order so I can display this glyph on a bit map image but I don't want to do this here, I'd like to render the glyph using opengl directly (this works fine for the non overlapping glyphs).

Does anyone know of a triangulation algorithm that can cater for overlapping contors or an algorithm that can remove overlaps?


Solution

  • You need a polygon boolean library like this one (open source) to perform a union operation between all character shapes, then to triangulate the outcome.