Constructor from three points.
86 : s_det(0), s_dxzero(0) {
87 mfunname(
"Parabola::Parabola(double x[3], double y[3])");
88
89 check_econd12a(x1, ==, x2,
"x3=" << x3 <<
" y1=" << y1 <<
" y2=" << y2
90 << " y3=" << y3 << '\n',
92 check_econd12a(x1, ==, x3,
"x2=" << x2 <<
" y1=" << y1 <<
" y2=" << y2
93 << " y3=" << y3 << '\n',
95 check_econd12a(x2, ==, x3,
"x1=" << x1 <<
" y1=" << y1 <<
" y2=" << y2
96 << " y3=" << y3 << '\n',
98 DynArr<DoubleAc> mat(3, 3);
99 DynLinArr<DoubleAc> par(3);
100 DynLinArr<DoubleAc> f(3);
101 f[0] = y1;
102 mat.ac(0, 2) = 1.0;
103 mat.ac(0, 1) = x1;
104 mat.ac(0, 0) = x1 * x1;
105 f[1] = y2;
106 mat.ac(1, 2) = 1.0;
107 mat.ac(1, 1) = x2;
108 mat.ac(1, 0) = x2 * x2;
109 f[2] = y3;
110 mat.ac(2, 2) = 1.0;
111 mat.ac(2, 1) = x3;
112 mat.ac(2, 0) = x3 * x3;
113
114 int ierr;
115 int szero;
116 DynArr<DoubleAc> mat_inv;
118
119 if (ierr == 0) {
120 par = mat_inv * f;
121 da = par[0];
122 db = par[1];
123 dc = par[2];
124 } else {
125 da = 0.0;
126 DynLinArr<int> s_var(3);
127 s_var[0] = 0;
128 s_var[1] = 1;
129 s_var[2] = 1;
130 DynArr<DoubleAc> mat_inv1(3, 3);
131
132
134 if (ierr != 0) {
135
136
137 mat.ac(1, 1) = mat.ac(0, 1);
138 mat.ac(1, 2) = mat.ac(0, 2);
139 f[1] = f[0];
140 s_var[0] = 0;
141 s_var[1] = 1;
142 s_var[2] = 1;
145 "should never happen\nmat=" << mat << "\ns_var=" << s_var
146 << "\nmat_inv=" << mat_inv,
148 }
149 par = mat_inv * f;
150 db = par[1];
151 dc = par[2];
152 }
153}