46#define M(row, col) m->v[(((row) - 1) * (m->n)) + (col) - 1]
63static int calccoef(
struct Control_Points *,
double *,
double *,
int);
64static int calcls(
struct Control_Points *,
struct MATRIX *,
double *,
double *,
66static int exactdet(
struct Control_Points *,
struct MATRIX *,
double *,
67 double *,
double *,
double *);
68static int solvemat(
struct MATRIX *,
double *,
double *,
double *,
double *);
69static double term(
int,
double,
double);
91 *e = E[0] + E[1] * e1 + E[2] * n1;
92 *n =
N[0] +
N[1] * e1 +
N[2] * n1;
100 *e = E[0] + E[1] * e1 + E[2] * n1 + E[3] * e2 + E[4] *
en + E[5] * n2;
101 *n =
N[0] +
N[1] * e1 +
N[2] * n1 +
N[3] * e2 +
N[4] *
en +
N[5] * n2;
113 *e = E[0] + E[1] * e1 + E[2] * n1 + E[3] * e2 + E[4] *
en + E[5] * n2 +
114 E[6] *
e3 + E[7] *
e2n + E[8] *
en2 + E[9] * n3;
115 *n =
N[0] +
N[1] * e1 +
N[2] * n1 +
N[3] * e2 +
N[4] *
en +
N[5] * n2 +
134 double N12[],
double E21[],
double N21[],
194 if (
cp->status[i] > 0)
213 status = exactdet(
cp, &
m, a,
b, E,
N);
215 status = calcls(
cp, &
m, a,
b, E,
N);
232 double b[],
double E[],
243 for (
j = 1;
j <=
m->n;
j++)
258 return solvemat(
m, a,
b, E,
N);
270 double b[],
double E[],
278 for (i = 1; i <=
m->n; i++) {
279 for (
j = i;
j <=
m->n;
j++)
281 a[i - 1] =
b[i - 1] = 0.0;
287 for (n = 0; n <
cp->count; n++) {
288 if (
cp->status[n] > 0) {
290 for (i = 1; i <=
m->n; i++) {
291 for (
j = i;
j <=
m->n;
j++)
292 M(i,
j) += term(i,
cp->e1[n],
cp->n1[n]) *
293 term(
j,
cp->e1[n],
cp->n1[n]);
295 a[i - 1] +=
cp->e2[n] * term(i,
cp->e1[n],
cp->n1[n]);
296 b[i - 1] +=
cp->n2[n] * term(i,
cp->e1[n],
cp->n1[n]);
306 for (i = 2; i <=
m->n; i++)
307 for (
j = 1;
j < i;
j++)
310 return solvemat(
m, a,
b, E,
N);
324static double term(
int term,
double e,
double n)
371static int solvemat(
struct MATRIX *
m,
double a[],
double b[],
double E[],
378 for (i = 1; i <=
m->n; i++) {
385 for (
i2 = i + 1;
i2 <=
m->n;
i2++) {
403 for (
j2 = 1;
j2 <=
m->n;
j2++) {
410 a[
imark - 1] = a[i - 1];
421 for (
i2 = 1;
i2 <=
m->n;
i2++) {
426 a[
i2 - 1] -= factor * a[i - 1];
427 b[
i2 - 1] -= factor *
b[i - 1];
435 for (i = 1; i <=
m->n; i++) {
436 E[i - 1] = a[i - 1] /
M(i, i);
437 N[i - 1] =
b[i - 1] /
M(i, i);
int order(int i_x, int i_y, int yNum)
void G_free(void *)
Free allocated memory.
int I_georef(double e1, double n1, double *e, double *n, double E[], double N[], int order)
int I_compute_georef_equations(struct Control_Points *cp, double E12[], double N12[], double E21[], double N21[], int order)