diff options
Diffstat (limited to 'test.c')
-rw-r--r-- | test.c | 32 |
1 files changed, 32 insertions, 0 deletions
@@ -9,6 +9,34 @@ struct SurviveContext * ctx; + + +static void dump_iface( struct SurviveObject * so, const char * prefix ) +{ + int i; + FILE * f; + char fname[1024]; + + sprintf( fname, "%s_points.csv", prefix ); + f = fopen( fname, "w" ); + for( i = 0; i < so->nr_locations; i++ ) + { + fprintf( f, "%g %g %g\n", so->sensor_locations[i*3+0], so->sensor_locations[i*3+1], so->sensor_locations[i*3+2] ); + } + fclose( f ); + + sprintf( fname, "%s_normals.csv", prefix ); + f = fopen( fname, "w" ); + for( i = 0; i < so->nr_locations; i++ ) + { + fprintf( f, "%g %g %g\n", so->sensor_normals[i*3+0], so->sensor_normals[i*3+1], so->sensor_normals[i*3+2] ); + } + fclose( f ); + +} + + + int main() { int magicon = 0; @@ -22,6 +50,10 @@ int main() return 1; } + dump_iface( survive_get_so_by_name( ctx, "HMD" ), "HMD" ); + dump_iface( survive_get_so_by_name( ctx, "WM0" ), "WM0" ); + dump_iface( survive_get_so_by_name( ctx, "WM1" ), "WM1" ); + while(survive_poll(ctx) == 0) { double Now = OGGetAbsoluteTime(); |