From d9ddd52427c070eca4d8039f4f47512ab102cf20 Mon Sep 17 00:00:00 2001 From: Werner Almesberger Date: Sun, 26 Sep 2010 05:48:31 -0300 Subject: [PATCH] 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 --- solidify/face.c | 1 + solidify/face.h | 2 +- solidify/povray.c | 3 +-- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/solidify/face.c b/solidify/face.c index d444a14..38caeb4 100644 --- a/solidify/face.c +++ b/solidify/face.c @@ -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; diff --git a/solidify/face.h b/solidify/face.h index 46fba86..4d37086 100644 --- a/solidify/face.h +++ b/solidify/face.h @@ -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 */ diff --git a/solidify/povray.c b/solidify/povray.c index 5e3f75e..ac8e70a 100644 --- a/solidify/povray.c +++ b/solidify/povray.c @@ -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,