Skip to content

Instantly share code, notes, and snippets.

@larsberg
Created August 1, 2014 21:53
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save larsberg/4b80d84e81562b6024ee to your computer and use it in GitHub Desktop.
Save larsberg/4b80d84e81562b6024ee to your computer and use it in GitHub Desktop.
OF svg to ofMesh
static void addSvgToMesh(string dir, ofMesh& m)
{
ofxSVG svg;
svg.load(dir);
for ( auto i=0; i<svg.getNumPath(); i++ )
{
auto& path = svg.getPathAt(i);
path.simplify();
auto pm = path.getTessellation();
if(pm.getIndices().size())
{
auto& v = pm.getVertices();
for(auto& i: pm.getIndices()) m.addVertex(v[i]);
}
else
{
for(auto& v: pm.getVertices()) m.addVertex(v);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment