Reimplement the "sane tolerance" in a better way

This commit is contained in:
Bradlee Speice 2012-06-25 18:09:54 -04:00
parent 3c314f12f3
commit 0b399525d0

View File

@ -67,6 +67,7 @@ int main( int argc, char** argv )
{"tolerance", required_argument, 0, 't'}, {"tolerance", required_argument, 0, 't'},
{"x-root", optional_argument, 0, 'x'}, {"x-root", optional_argument, 0, 'x'},
{"center", no_argument, 0, 'c'}, {"center", no_argument, 0, 'c'},
{"sane-tolerance", required_argument, 0, 'o'},
{0, 0, 0, 0} {0, 0, 0, 0}
}; };
@ -133,6 +134,13 @@ int main( int argc, char** argv )
case 'c': case 'c':
useCenter = 1; useCenter = 1;
case 'o':
tolerance = atoi(optarg);
/* Provide a more sane way to configure tolerance:
* --sane-tolerance=100 ~= INT_MAX */
tolerance = pow(1.2397076, tolerance);
break;
case '?': case '?':
/* Error routine */ /* Error routine */
break; break;
@ -224,6 +232,8 @@ Usage: \n\
\t\t\t\tsince it is an optional argument.\n\ \t\t\t\tsince it is an optional argument.\n\
\t-c, --center:\t\tThe output points should be centered on the sub-image, rather\n\ \t-c, --center:\t\tThe output points should be centered on the sub-image, rather\n\
\t\t\t\tthan the top-left corner.\n\ \t\t\t\tthan the top-left corner.\n\
\t-o, --sane-tolerance:\tSet the tolerance using a scale of 1-100,\n\
\t\t\t\trather than INT_MIN to INT_MAX (100 ~= INT_MAX)\n\
\n\ \n\
If you have any questions, comments, concerns, email bspeice@uncc.edu\n" ); If you have any questions, comments, concerns, email bspeice@uncc.edu\n" );