Permalink
Browse files

Different old_axis orientations and parameters

  • Loading branch information...
tias committed Jun 15, 2012
1 parent 552ff15 commit c4bad4e0fe03d3839d595145da8f3f4c656e1d74
Showing with 34 additions and 5 deletions.
  1. +4 −0 src/calibrator/Tester.hpp
  2. +30 −5 src/tester.cpp
@@ -44,6 +44,10 @@ class CalibratorTester: public Calibrator
// emulate the driver processing the coordinates in 'raw'
XYinfo emulate_driver(XYinfo& raw, bool useNewAxis, XYinfo screen, XYinfo device);
void new_axis_print() {
new_axis.print();
}
};
#endif
View
@@ -18,7 +18,20 @@ int main() {
int slack = 2; // amount of pixels result can be off target
XYinfo dev_res(0, 1000, 0, 1000);
XYinfo old_axis(0, 1000, 0, 1000);
std::vector<XYinfo> old_axes;
old_axes.push_back( XYinfo(0, 1000, 0, 1000) );
old_axes.push_back( XYinfo(1000, 0, 0, 1000) );
old_axes.push_back( XYinfo(0, 1000, 1000, 0) );
old_axes.push_back( XYinfo(1000, 0, 0, 1000) );
old_axes.push_back( XYinfo(0, 1000, 0, 1000, 1, 0, 0) );
old_axes.push_back( XYinfo(0, 1000, 0, 1000, 1, 0, 1) );
old_axes.push_back( XYinfo(0, 1000, 0, 1000, 1, 1, 0) );
old_axes.push_back( XYinfo(0, 1000, 0, 1000, 1, 1, 1) );
old_axes.push_back( XYinfo(1000, 0, 0, 1000, 1, 0, 0) );
old_axes.push_back( XYinfo(1000, 0, 0, 1000, 1, 0, 1) );
old_axes.push_back( XYinfo(1000, 0, 0, 1000, 1, 1, 0) );
old_axes.push_back( XYinfo(1000, 0, 0, 1000, 1, 1, 1) );
// raw device coordinates to emulate
std::vector<XYinfo> raw_coords;
@@ -35,11 +48,15 @@ int main() {
raw_coords.push_back( XYinfo(883, 233, 105, 783) );
raw_coords.push_back( XYinfo(883, 233, 783, 105) );
for (unsigned c=0; c != raw_coords.size(); c++) {
CalibratorTester calib("Tester", old_axis);
for (unsigned a=0; a != old_axes.size(); a++) {
XYinfo old_axis(old_axes[a]);
printf("Old axis: "); old_axis.print();
for (unsigned c=0; c != raw_coords.size(); c++) {
XYinfo raw(raw_coords[c]);
printf("Raw: "); raw.print();
//printf("Raw: "); raw.print();
CalibratorTester calib("Tester", old_axis);
// clicked from raw
XYinfo clicked = calib.emulate_driver(raw, false, screen_res, dev_res);// false=old_axis
@@ -59,12 +76,20 @@ int main() {
abs(target.x.max - result.x.max) > slack ||
abs(target.y.min - result.y.min) > slack ||
abs(target.y.max - result.y.max) > slack) {
printf("Old axis: "); old_axis.print();
printf("Raw: "); raw.print();
printf("Clicked: "); clicked.print();
printf("New axis: "); calib.new_axis_print();
printf("Error: difference between target and result > %i:\n", slack);
printf("\tTarget: "); target.print();
printf("\tResult: "); result.print();
exit(1);
}
printf("OK\n");
printf(".");
} // loop over raw_coords
printf(" OK\n");
} // loop over old_axes
}

0 comments on commit c4bad4e

Please sign in to comment.