The unified diff between revisions [8583f573..] and [26704bfc..] is displayed below. It can also be downloaded as a raw diff.
This diff has been restricted to the following files: 'src/lsi/map3d.c'
# # old_revision [8583f573519b60d2a4dfb35aa4ec8079f05b88c1] # new_revision [26704bfc7dde9382e68dbefa013c51b37b934b1d] # # patch "src/lsi/map3d.c" # from [ac23569032a89ca3240a9af9419636f07b2148a8] # to [21c3208dd844af80da0ef68286a121ae0203d17b] # ============================================================ --- src/lsi/map3d.c ac23569032a89ca3240a9af9419636f07b2148a8 +++ src/lsi/map3d.c 21c3208dd844af80da0ef68286a121ae0203d17b @@ -24,6 +24,7 @@ struct light { double cp[3][3]; double pan[3]; double tilt[3]; + int invert; }; struct light map3d_cal[NLIGHTS]; @@ -88,6 +89,10 @@ int map3d_load(void) return 1; } +/* + * invert bit 0 = swap x/z + bit 1 = invert pan + */ void map3d_transform(int light, double x, double y, double z, int *pan, int *tilt) { @@ -97,9 +102,15 @@ void map3d_transform(int light, double x // printf("Transforming for light %d: (%f, %f, %f)\n", light, x, y, z); fflush(stdout); - pv[0] = x; - pv[1] = y; - pv[2] = z; + if (map3d_cal[light].invert & 1) { + pv[0] = z; + pv[1] = y; + pv[2] = x; + } else { + pv[0] = x; + pv[1] = y; + pv[2] = z; + } multiply(light, pv, rv); normalise(rv); t = asin(rv[1]); @@ -115,6 +126,8 @@ void map3d_transform(int light, double x *tilt = 0; if (*tilt > 255) *tilt = 255; + if (map3d_cal[light].invert & 2) + *pan = 255-*pan; // printf("pan = %d, tilt = %d\n", *pan, *tilt); } @@ -594,7 +607,7 @@ int map3d_calibrate(int light) tx, ty = pan, tilt of light fixture tz = distance from light fixture to (0, 0, 0) */ -void map3d_setparams(int light, int opan, int otilt, double lpan, double ltilt, double dist) +void map3d_setparams(int light, int opan, int otilt, double lpan, double ltilt, double dist, int invert) { double n[3]; double up[3]; @@ -636,6 +649,8 @@ void map3d_setparams(int light, int opan map3d_cal[light].M[3][0] = dist*v[0]; map3d_cal[light].M[3][1] = dist*v[1]; map3d_cal[light].M[3][2] = dist*v[2]; + printf ("setting invert = %d\n", invert); + map3d_cal[light].invert = invert; printf("\t%f\t%f\t%f\t\t%f\n", map3d_cal[light].M[0][0], map3d_cal[light].M[0][1], map3d_cal[light].M[0][2], map3d_cal[light].M[3][0]); printf("\t%f\t%f\t%f\t\t%f\n", map3d_cal[light].M[1][0], map3d_cal[light].M[1][1], map3d_cal[light].M[1][2], map3d_cal[light].M[3][1]);