示例#1
0
/* returns 0 if succesful, 2 if cal points 'n markers not ok, and 1 if cancelled
   during operation */
int calibrate_view (Desktop * d, CEvent * ce, int leave_out, int calc_distortion)
{
    char *omitted, *omitmin;
    int omit;
    double ermin = 10e90;
    int leaveout1 = -1, leaveout2 = -1;
    int l1 = -1, l2 = -1;

    stop = 0;

    set_current_from_pointer (d, ce);
    omit = d->num_cal_points - d->view[d->current_view].num_marks;

    {
	if (d->num_cal_points - leave_out < MIN_MARKS_NEEDED_TO_CALIBRATE) {
	    Cerrordialog (0, 0, 0, " Calibrate ", " You have at least %d \
		calibration points to calibrate ", MIN_MARKS_NEEDED_TO_CALIBRATE);
	    return 2;
	}
	if (omit < 0) {
	    Cerrordialog (0, 0, 0, " Calibrate ", \
				" You have more markers than calibration points ");
	    return 2;
	}
	if (d->view[d->current_view].num_marks < MIN_MARKS_NEEDED_TO_CALIBRATE) {
	    Cerrordialog (0, 0, 0, " Calibrate ", \
			" You have at least %d markers to calibrate ", \
					MIN_MARKS_NEEDED_TO_CALIBRATE);
	    return 2;
	}
    }
示例#2
0
int load_calibration_file (Desktop * d, const char *filename)
{
    FILE *f;
    int n, i = 0;
    Vec *v;

    f = fopen (filename, "r");
    if (!f) {
	Cerrordialog (0, 0, 0, " Load Calibration File ", \
		    get_sys_error (" Error trying to load file. "));
	return 1;
    }
    v = Cmalloc (MAX_CAL_POINTS * sizeof (Vec));

    while (!feof (f)) {
	n = fscanf (f, "%lf %lf %lf ", &v[i].x, &v[i].y, &v[i].z);
	if (n == 3) {
	    i++;
	} else {
	    Cerrordialog (0, 0, 0, " Load Calibration File ", \
		    " Format error in calibration file ");
	    i = 0;
	    break;
	}
    }
    fclose (f);
    if (i) {
	d->num_cal_points = i;
	destroy ((void *) &(d->cal_points));
	d->cal_points = Cmalloc (i * sizeof (Vec));
	memcpy (d->cal_points, v, i * sizeof (Vec));
	destroy ((void *) &(d->cal_file));
	d->cal_file = strdup (filename);
    }
/* else { cal points not changed */
    destroy ((void *) &v);
 /*   fclose (f);  TLD 2/6/08 */
    return !i;
}
示例#3
0
void textformaterror (int line, const char *ident)
{
    Cerrordialog (CMain, 20, 20, " Compile text to 3D ", " A text format error was encounted at line %d,\nwhile trying to draw 3d item to widget %s.\n ", line, ident);
}