From bc65f5ce142ed203e91d8b35a1e61009ef4fb098 Mon Sep 17 00:00:00 2001 From: cnlohr Date: Mon, 19 Dec 2016 02:00:08 -0500 Subject: allow for easy config dumping --- test.c | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) (limited to 'test.c') diff --git a/test.c b/test.c index 537b2e5..17fa7f3 100644 --- a/test.c +++ b/test.c @@ -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(); -- cgit v1.2.3