1
0
mirror of git://projects.qi-hardware.com/ben-scans.git synced 2024-11-22 09:30:38 +02:00

In POV-Ray output, move faces to more correct Z locations.

- solidify/povray.c: update title for renaming
- solidify/povray.c (povray_face, povray): flip the bottom face
- solidify/povray.c (povray_face, povray): instead of centering the face on
  Z, shift it to its z0 position
- solidify/povray.c (povray_face, povray): split the distance between faces
  equally among them
This commit is contained in:
Werner Almesberger 2010-09-25 04:40:08 -03:00
parent f37441a7c2
commit f0a8bcd95e

View File

@ -1,5 +1,5 @@
/* /*
* solid.c - Data structure and handling of a solid made of two opposing faces * povray.c - Generate POV-Ray output
* *
* Written 2010 by Werner Almesberger * Written 2010 by Werner Almesberger
* Copyright 2010 by Werner Almesberger * Copyright 2010 by Werner Almesberger
@ -70,7 +70,7 @@ static void sanitize(const char *s, char *res)
*/ */
static void povray_face(const struct face *f, const char *side, static void povray_face(const struct face *f, const char *side,
const char *prefix) const char *prefix, int flip, double dist)
{ {
int sz = f->a->max_z-f->a->min_z; int sz = f->a->max_z-f->a->min_z;
@ -86,9 +86,15 @@ static void povray_face(const struct face *f, const char *side,
"\t scale <%g, %g, %g>\n" "\t scale <%g, %g, %g>\n"
"\t rotate <90, 0, 0>\n" "\t rotate <90, 0, 0>\n"
"\t translate <%g, %g, %g>\n" "\t translate <%g, %g, %g>\n"
"\t translate <0, 0, %g>\n"
"%s" /* flip bottom face */
"\t translate <0, 0, %g>\n"
"\t}\n", prefix, side, "\t}\n", prefix, side,
f->sx*f->x_step, sz*f->z_step, f->sy*f->y_step, f->sx*f->x_step, sz*f->z_step, f->sy*f->y_step,
-f->sx*f->x_step/2, f->sy*f->y_step/2, -sz*f->z_step/2); -f->sx*f->x_step/2, f->sy*f->y_step/2, f->a->min_z*f->z_step,
-f->z_ref*f->z_step,
flip ? "\t rotate <180, 0, 0>\n" : "",
dist*f->z_step);
} }
@ -108,7 +114,7 @@ void povray(const char *name, const struct solid *s)
sanitize(name, tmp); sanitize(name, tmp);
printf("#declare Part_%s =\n intersection {\n", tmp); printf("#declare Part_%s =\n intersection {\n", tmp);
povray_face(s->a, "top", name); povray_face(s->a, "top", name, 0, s->dist/2);
povray_face(s->b, "bot", name); povray_face(s->b, "bot", name, 1, -s->dist/2);
printf(" }\n"); printf(" }\n");
} }