Transform shape built of contour splines to simple polygons
Posted
by Cheery
on Stack Overflow
See other posts from Stack Overflow
or by Cheery
Published on 2010-05-06T14:13:42Z
Indexed on
2010/05/06
14:18 UTC
Read the original article
Hit count: 179
I've dumped glyphs from truetype file so I can play with them. They have shape contours that consist from quadratic bezier curves and lines. I want to output triangles for such shapes so I can visualize them for the user.
Traditionally I might use libfreetype or scan-rasterise this kind of contours. But I want to produce extruded 3D meshes from the fonts and make other distortions with them.
So, how to polygonise shapes consisting from quadratic bezier curves and lines? There's many contours that form the shape together. Some contours are additive and others are subtractive. The contours are never open. They form a loop.
(Actually, I get only contour vertices from ttf glyphs, those vertices define whether they are part of the curve or not. Even though it is easy to decompose these into bezier curves and lines, knowing the data is represented this way may be helpful for polygonizing the contours to triangles)
© Stack Overflow or respective owner