mirror of
git://projects.qi-hardware.com/cae-tools.git
synced 2025-04-21 12:27:27 +03:00
ptrude/: added (overly, this far) simple extruder
This commit is contained in:
@@ -17,6 +17,7 @@
|
||||
#include <math.h>
|
||||
|
||||
#include "path.h"
|
||||
#include "extrude.h"
|
||||
#include "ptrude.h"
|
||||
|
||||
|
||||
@@ -50,6 +51,29 @@ static void close_file(FILE *file)
|
||||
}
|
||||
|
||||
|
||||
static void do_face(void *data, struct point a, struct point b, struct point c)
|
||||
{
|
||||
FILE *file = data;
|
||||
|
||||
fprintf(file, "facet normal 0 0 0\n");
|
||||
fprintf(file, " outer loop\n");
|
||||
fprintf(file, " vertex %f %f %f\n", a.x, a.y, a.z);
|
||||
fprintf(file, " vertex %f %f %f\n", b.x, b.y, b.z);
|
||||
fprintf(file, " vertex %f %f %f\n", c.x, c.y, c.z);
|
||||
fprintf(file, " endloop\nendfacet\n");
|
||||
}
|
||||
|
||||
|
||||
static void do_extrude(const struct path *path, const struct path *shape)
|
||||
{
|
||||
FILE *file = stdout;
|
||||
|
||||
fprintf(file, "solid ptrude\n");
|
||||
extrude(path, shape, do_face, file);
|
||||
fprintf(file, "endsolid ptrude\n");
|
||||
}
|
||||
|
||||
|
||||
static void usage(const char *name)
|
||||
{
|
||||
fprintf(stderr,
|
||||
@@ -106,7 +130,7 @@ int main(int argc, char **argv)
|
||||
*/
|
||||
path = round_path(path, r, sqrt(d));
|
||||
shape = round_path(shape, r, sqrt(d));
|
||||
/* ... now all that's missing is the extrusion :-) */
|
||||
do_extrude(path, shape);
|
||||
} else {
|
||||
shape = round_path(shape, r, d);
|
||||
save_path(stdout, shape);
|
||||
|
||||
Reference in New Issue
Block a user