Constructor from three points.
22 : s_det(0), s_dxzero(0) {
23 mfunname(
"Parabol::Parabol(double x[3], double y[3])");
24
25 check_econd12a(x[0], ==, x[1],
"x[2]=" << x[2] <<
" y[0]=" << y[0] <<
" y[1]="
26 << y[1] << " y[2]=" << y[2] << '\n',
28 check_econd12a(x[0], ==, x[2],
"x[1]=" << x[1] <<
" y[0]=" << y[0] <<
" y[1]="
29 << y[1] << " y[2]=" << y[2] << '\n',
31 check_econd12a(x[1], ==, x[2],
"x[0]=" << x[0] <<
" y[0]=" << y[0] <<
" y[1]="
32 << y[1] << " y[2]=" << y[2] << '\n',
34 DynArr<DoubleAc> mat(3, 3);
35 DynLinArr<DoubleAc> par(3);
36 DynLinArr<DoubleAc> f(3);
37 for (int i = 0; i < 3; ++i) {
38 f[i] = y[i];
39 mat.ac(i, 2) = 1.0;
40 mat.ac(i, 1) = x[i];
41 mat.ac(i, 0) = x[i] * x[i];
42 }
43 int ierr;
44 int szero;
45 DynArr<DoubleAc> mat_inv;
47
48 if (ierr == 0) {
49 par = mat_inv * f;
50
51
52
53
54
55 da = par[0];
56 db = par[1];
57 dc = par[2];
58 } else {
59 da = 0.0;
60 DynLinArr<int> s_var(3);
61 s_var[0] = 0;
62 s_var[1] = 1;
63 s_var[2] = 1;
64 DynArr<DoubleAc> mat_inv1(3, 3);
65
66
68 if (ierr != 0) {
69
70
71 mat.ac(1, 1) = mat.ac(0, 1);
72 mat.ac(1, 2) = mat.ac(0, 2);
73 f[1] = f[0];
74 s_var[0] = 0;
75 s_var[1] = 1;
76 s_var[2] = 1;
79 "should never happen\nmat=" << mat << "\ns_var=" << s_var
80 << "\nmat_inv=" << mat_inv,
82 }
83 par = mat_inv * f;
84 db = par[1];
85 dc = par[2];
86 }
87}
#define check_econd11a(a, signb, add, stream)
#define check_econd12a(a, sign, b, add, stream)
void inverse_DynArr_prot(const DynArr< DoubleAc > &mi, DynArr< DoubleAc > &mr, int &szero, int &serr, int s_stop)