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