/* * stl.c - Genererate STL slice from polygon set * * Written 2013 by Werner Almesberger * Copyright 2013 Werner Almesberger * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. */ #include #include "poly2d.h" #include "path.h" #include "stl.h" void stl(const char *name, const struct path *paths) { struct p2d *polys; struct f2d *faces; const struct f2d *f; polys = paths_to_polys(paths); faces = f2d_tri(polys); for (f = faces; f; f = f->next) printf("%f/%f %f/%f %f/%f (%p %p %p)\n", f->v[0]->x, f->v[0]->y, f->v[1]->x, f->v[1]->y, f->v[2]->x, f->v[2]->y, f->v[0], f->v[1], f->v[2]); p2d_free_all(polys); f2d_free_all(faces); }