Date:2010-09-25 09:40:08 (13 years 5 months ago)
Author:Werner Almesberger
Commit:f0a8bcd95e978480a1ef8a8a8f4a89b46bdc6e0d
Message: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
Files: solidify/povray.c (4 diffs)

Change Details

solidify/povray.c
11/*
2 * solid.c - Data structure and handling of a solid made of two opposing faces
2 * povray.c - Generate POV-Ray output
33 *
44 * Written 2010 by Werner Almesberger
55 * Copyright 2010 by Werner Almesberger
...... 
7070 */
7171
7272static void povray_face(const struct face *f, const char *side,
73    const char *prefix)
73    const char *prefix, int flip, double dist)
7474{
7575    int sz = f->a->max_z-f->a->min_z;
7676
...... 
8686"\t scale <%g, %g, %g>\n"
8787"\t rotate <90, 0, 0>\n"
8888"\t translate <%g, %g, %g>\n"
89"\t translate <0, 0, %g>\n"
90"%s" /* flip bottom face */
91"\t translate <0, 0, %g>\n"
8992"\t}\n", prefix, side,
9093    f->sx*f->x_step, sz*f->z_step, f->sy*f->y_step,
91    -f->sx*f->x_step/2, f->sy*f->y_step/2, -sz*f->z_step/2);
94    -f->sx*f->x_step/2, f->sy*f->y_step/2, f->a->min_z*f->z_step,
95    -f->z_ref*f->z_step,
96    flip ? "\t rotate <180, 0, 0>\n" : "",
97    dist*f->z_step);
9298}
9399
94100
...... 
108114
109115    sanitize(name, tmp);
110116    printf("#declare Part_%s =\n intersection {\n", tmp);
111    povray_face(s->a, "top", name);
112    povray_face(s->b, "bot", name);
117    povray_face(s->a, "top", name, 0, s->dist/2);
118    povray_face(s->b, "bot", name, 1, -s->dist/2);
113119    printf(" }\n");
114120}

Archive Download the corresponding diff file

Branches:
master



interactive