1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45
|
typedef struct
{
int n;
double *x, *y;
}
curve_type;
main(argc, argv)
int argc;
char *argv[];
{
curve_type model[10];
int[][] imageData;
readmodel(modelfile, model);
readData(imageFile, imageData);
fitmodel(imageData, model);
}
fitmodel(int imageData, curve_type *model)
{
int p0[9] = {-1, 0, 0, 0, 0, 0, 1, 2, 1};
int p1[9] = {-1, -1, -1, -1, 3, -1, 2, 3, 0};
findsegment(model[p1[k]]);
}
int findsegment(curve_type curve)
{
int np;
double *xp, *yp;
np = curve.n;
xp = curve.x;
yp = curve.y;
for(int i=1; i<np-1; i++)
{
x1 = xp[i-1];
y1 = yp[i-1];
x2 = xp[i];
y2 = yp[i];
x3 = xp[i+1];
y3 = yp[i+1];
and further....
}
}
|