For convenience, record maximum Z size in the face structure.

- solidify/face.h (struct face), solidify/face.c (read_file): keep the mesh's
  maximum Z size in sz, similar to sx and sy
- solidify/povray.c (povray_face): use f->sz insead of calculating it
This commit is contained in:
Werner Almesberger 2010-09-26 05:48:31 -03:00
parent 17824f4cb4
commit d9ddd52427
3 changed files with 3 additions and 3 deletions

View File

@ -136,6 +136,7 @@ static struct face *read_file(const char *name)
f->sx = f->a->max_x-f->a->min_x+1;
f->sy = f->a->max_y-f->a->min_y+1;
f->sz = f->a->max_z-f->a->min_z+1;
f->cx = (f->a->min_x+f->a->max_x)/2;
f->cy = (f->a->min_y+f->a->max_y)/2;

View File

@ -20,7 +20,7 @@
struct face {
struct array *a;
double x_step, y_step, z_step;
int sx, sy; /* size */
int sx, sy, sz; /* size */
int cx, cy; /* center */
int z_ref;
double fx, fy; /* inclination factor */

View File

@ -73,7 +73,6 @@ static void sanitize(const char *s, char *res)
static void povray_face(const struct face *f, const char *side,
const char *prefix, int flip, double dist)
{
int sz = f->a->max_z-f->a->min_z;
double a;
/*
@ -99,7 +98,7 @@ static void povray_face(const struct face *f, const char *side,
"%s" /* flip bottom face */
"\t translate <0, 0, %g> /* half the distance between faces */\n"
"\t}\n", prefix, side,
f->sx*f->x_step, sz*f->z_step, f->sy*f->y_step,
f->sx*f->x_step, (f->sz-1)*f->z_step, f->sy*f->y_step,
-f->sx*f->x_step/2, f->sy*f->y_step/2,
-atan(f->fy)/M_PI*180, -atan(f->fx)/M_PI*180,
f->a->min_z*f->z_step,