/* * 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 (%d %d %d)\n", f->x[0], f->y[0], f->x[1], f->y[1], f->x[2], f->y[2], f->side[0], f->side[1], f->side[2]); p2d_free_all(polys); f2d_free_all(faces); }