mirror of
git://projects.qi-hardware.com/cae-tools.git
synced 2024-12-23 13:16:47 +02:00
Added remaining transformations to POV-Ray output. Added example. Cleaned up
main.pov - solidify/povray.c (povray_face): added inclination of the z0 plane - solidify/povray.c (povray_face): added overlap transform (rotation and shift) - solidify/povray.c (povray_face): added comments to all the POV-Ray commands - solidify/batcvr.sfy: battery cover example (almost looks good) - solidify/main.pov: added second light source slightly below the xy plane - solidify/main.pov: use "object" instead of "union" to place the part - solidify/main.pov: make material less transparent (50% -> 20%) - solidify/main.pov: added second battery cover, showing edge and bottom
This commit is contained in:
parent
e08bd77d51
commit
17824f4cb4
7
solidify/batcvr.sfy
Normal file
7
solidify/batcvr.sfy
Normal file
@ -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
|
@ -21,6 +21,11 @@ light_source {
|
|||||||
color White
|
color White
|
||||||
}
|
}
|
||||||
|
|
||||||
|
light_source {
|
||||||
|
<-100, -500, -10>
|
||||||
|
color White
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Mark the coordinate axes:
|
* Mark the coordinate axes:
|
||||||
* - a red unit sphere at the center
|
* - a red unit sphere at the center
|
||||||
@ -44,8 +49,16 @@ sphere { < 0, 0, 10>, 1 pigment { color Yellow } }
|
|||||||
metallic
|
metallic
|
||||||
}
|
}
|
||||||
|
|
||||||
union {
|
object {
|
||||||
Part_batcvr
|
Part_batcvr
|
||||||
pigment { rgbf <0.9, 0.9, 0.9, 0.5> }
|
pigment { rgbf <0.9, 0.9, 0.9, 0.2> }
|
||||||
finish { Finish }
|
finish { Finish }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
object {
|
||||||
|
Part_batcvr
|
||||||
|
pigment { rgbf <1, 0.8, 0.8, 0.2> }
|
||||||
|
finish { Finish }
|
||||||
|
translate <0, 0, 25>
|
||||||
|
rotate <0, 20, 80>
|
||||||
|
}
|
||||||
|
@ -14,6 +14,7 @@
|
|||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#include <math.h>
|
||||||
|
|
||||||
#include "face.h"
|
#include "face.h"
|
||||||
#include "solid.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)
|
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;
|
||||||
|
double a;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* 1/65535 = 0.000015..., so we set the water level a bit lower, e.g.,
|
* 1/65535 = 0.000015..., so we set the water level a bit lower, e.g.,
|
||||||
* to 0.0001
|
* to 0.0001
|
||||||
*/
|
*/
|
||||||
|
a = asin(-f->m.a[0][1])/M_PI*180;
|
||||||
|
if (f->m.a[0][0] < 0)
|
||||||
|
a = 180-a;
|
||||||
printf(
|
printf(
|
||||||
"\theight_field {\n"
|
"\theight_field {\n"
|
||||||
"\t pgm \"%s-%s.pgm\"\n"
|
"\t pgm \"%s-%s.pgm\"\n"
|
||||||
"\t water_level 0.00001\n"
|
"\t water_level 0.00001\n"
|
||||||
"\t smooth\n"
|
"\t smooth\n"
|
||||||
"\t scale <%g, %g, %g>\n"
|
"\t scale <%g, %g, %g> /* scale from unit cube to real size */\n"
|
||||||
"\t rotate <90, 0, 0>\n"
|
"\t rotate <90, 0, 0> /* swap Y/Z axis */\n"
|
||||||
"\t translate <%g, %g, %g>\n"
|
"\t translate <%g, %g, 0> /* move to X/Y center */\n"
|
||||||
"\t translate <0, 0, %g>\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 */
|
"%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,
|
"\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, 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,
|
-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);
|
dist*f->z_step);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user