diff --git a/solidify/batcvr.sfy b/solidify/batcvr.sfy new file mode 100644 index 0000000..2b52924 --- /dev/null +++ b/solidify/batcvr.sfy @@ -0,0 +1,7 @@ +http://projects.qi-hardware.com/index.php/p/ben-scans/source/tree/master/data/csv/ben-batcvr-outside-100um.txt.bz2 +http://projects.qi-hardware.com/index.php/p/ben-scans/source/tree/master/data/csv/ben-batcvr-inside-100um.txt.bz2 +1.16 +8.925 -0.0559506 2.17492 +-1.20855 -0.217572 0.230146 +8.575 -0.01507 0.548847 +-0 0 0 diff --git a/solidify/main.pov b/solidify/main.pov index 44b79e7..5c07a75 100644 --- a/solidify/main.pov +++ b/solidify/main.pov @@ -21,6 +21,11 @@ light_source { color White } +light_source { + <-100, -500, -10> + color White +} + /* * Mark the coordinate axes: * - a red unit sphere at the center @@ -44,8 +49,16 @@ sphere { < 0, 0, 10>, 1 pigment { color Yellow } } metallic } -union { +object { Part_batcvr - pigment { rgbf <0.9, 0.9, 0.9, 0.5> } + pigment { rgbf <0.9, 0.9, 0.9, 0.2> } finish { Finish } } + +object { + Part_batcvr + pigment { rgbf <1, 0.8, 0.8, 0.2> } + finish { Finish } + translate <0, 0, 25> + rotate <0, 20, 80> +} diff --git a/solidify/povray.c b/solidify/povray.c index b31b853..5e3f75e 100644 --- a/solidify/povray.c +++ b/solidify/povray.c @@ -14,6 +14,7 @@ #include #include #include +#include #include "face.h" #include "solid.h" @@ -73,27 +74,39 @@ 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; /* * 1/65535 = 0.000015..., so we set the water level a bit lower, e.g., * to 0.0001 */ + a = asin(-f->m.a[0][1])/M_PI*180; + if (f->m.a[0][0] < 0) + a = 180-a; printf( "\theight_field {\n" "\t pgm \"%s-%s.pgm\"\n" "\t water_level 0.00001\n" "\t smooth\n" -"\t scale <%g, %g, %g>\n" -"\t rotate <90, 0, 0>\n" -"\t translate <%g, %g, %g>\n" -"\t translate <0, 0, %g>\n" +"\t scale <%g, %g, %g> /* scale from unit cube to real size */\n" +"\t rotate <90, 0, 0> /* swap Y/Z axis */\n" +"\t translate <%g, %g, 0> /* move to X/Y center */\n" +"\t rotate <%g, %g, 0> /* z0 plane tilt */\n" +"\t translate <0, 0, %g> /* min_z offset */\n" +"\t translate <0, 0, %g> /* z0 plane offset */\n" +"\t rotate <0, 0, %g> /* overlay - rotation */\n" +"\t translate <%g, %g, 0> /* overlay - shift */\n" "%s" /* flip bottom face */ -"\t translate <0, 0, %g>\n" +"\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/2, f->sy*f->y_step/2, f->a->min_z*f->z_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, -f->z_ref*f->z_step, - flip ? "\t rotate <180, 0, 0>\n" : "", + a, + f->m.b[0]*f->x_step, f->m.b[1]*f->y_step, + flip ? "\t rotate <0, 180, 0>\t/* flip bottom face */\n" : "", dist*f->z_step); }