175 const unsigned int val_6 = 6;
176 const unsigned int val_5 = 5;
177 double det_threshold = 1e-10;
179 const unsigned int index_0 = 0;
180 const unsigned int index_1 = 1;
181 const unsigned int index_2 = 2;
182 const unsigned int index_3 = 3;
183 const unsigned int index_4 = 4;
184 const unsigned int index_5 = 5;
188 double A = cP_[index_0];
189 double B = cP_[index_1];
190 double C = cP_[index_2];
192 double X0 = cP_[index_3];
193 double Y0 = cP_[index_4];
194 double Z0 = cP_[index_5];
199 double s = ((X0 * X0) + (Y0 * Y0) + (Z0 * Z0)) - (r * r);
200 double det = (A * X0) + (B * Y0) + (C * Z0);
205 K[index_0] = (1 - (val_2 * A * X0)) + (A * A * s);
206 K[index_1] = (1 - (val_2 * B * Y0)) + (B * B * s);
207 K[index_2] = ((-A * Y0) - (B * X0)) + (A * B * s);
208 K[index_3] = ((-C * X0) - (A * Z0)) + (A * C * s);
209 K[index_4] = ((-C * Y0) - (B * Z0)) + (B * C * s);
210 K[index_5] = (1 - (val_2 * C * Z0)) + (C * C * s);
213 double det = (K[index_2] * K[index_2]) - (K[index_0] * K[index_1]);
214 if (fabs(det) < det_threshold) {
218 double xc = ((K[index_1] * K[index_3]) - (K[index_2] * K[index_4])) / det;
219 double yc = ((K[index_0] * K[index_4]) - (K[index_2] * K[index_3])) / det;
221 double c = sqrt(((K[index_0] - K[index_1]) * (K[index_0] - K[index_1])) + (4 * K[index_2] * K[index_2]));
222 double s = 2 * (((K[index_0] * xc * xc) + (2 * K[index_2] * xc * yc) + (K[1] * yc * yc)) - K[index_5]);
226 if (fabs(K[index_2]) < std::numeric_limits<double>::epsilon()) {
229 A = sqrt(s / ((K[0] + K[1]) + c));
230 B = sqrt(s / ((K[0] + K[1]) - c));
233 A = sqrt(s / ((K[0] + K[1]) - c));
234 B = sqrt(s / ((K[0] + K[1]) + c));
238 E = ((K[1] - K[0]) + c) / (val_2 * K[index_2]);
240 A = sqrt(s / ((K[0] + K[1]) + c));
241 B = sqrt(s / ((K[0] + K[1]) - c));
244 A = sqrt(s / ((K[0] + K[1]) - c));
245 B = sqrt(s / ((K[0] + K[1]) + c));
275 const unsigned int val_7 = 7;
279 const unsigned int index_0 = 0;
280 const unsigned int index_1 = 1;
281 const unsigned int index_2 = 2;
282 const unsigned int index_3 = 3;
283 const unsigned int index_4 = 4;
284 const unsigned int index_5 = 5;
285 const unsigned int index_6 = 6;
286 A = (noMo[index_0][0] *
oP[0]) + (noMo[index_0][1] *
oP[1]) + (noMo[index_0][index_2] *
oP[index_2]);
287 B = (noMo[index_1][0] *
oP[0]) + (noMo[index_1][1] *
oP[1]) + (noMo[index_1][index_2] *
oP[index_2]);
288 C = (noMo[index_2][0] *
oP[0]) + (noMo[index_2][1] *
oP[1]) + (noMo[index_2][index_2] *
oP[index_2]);
291 X0 = noMo[index_0][index_3] + (noMo[index_0][0] *
oP[index_3]) + (noMo[index_0][1] *
oP[index_4]) + (noMo[index_0][index_2] *
oP[index_5]);
292 Y0 = noMo[index_1][index_3] + (noMo[index_1][0] *
oP[index_3]) + (noMo[index_1][1] *
oP[index_4]) + (noMo[index_1][index_2] *
oP[index_5]);
293 Z0 = noMo[index_2][index_3] + (noMo[index_2][0] *
oP[index_3]) + (noMo[index_2][1] *
oP[index_4]) + (noMo[index_2][index_2] *
oP[index_5]);
316 const unsigned int index_0 = 0;
317 const unsigned int index_1 = 1;
318 const unsigned int index_2 = 2;
319 const unsigned int index_3 = 3;
320 const unsigned int index_4 = 4;
321 const unsigned int index_5 = 5;
322 const unsigned int index_6 = 6;
323 A = (cMo[index_0][0] *
oP[0]) + (cMo[index_0][1] *
oP[1]) + (cMo[index_0][index_2] *
oP[index_2]);
324 B = (cMo[index_1][0] *
oP[0]) + (cMo[index_1][1] *
oP[1]) + (cMo[index_1][index_2] *
oP[index_2]);
325 C = (cMo[index_2][0] *
oP[0]) + (cMo[index_2][1] *
oP[1]) + (cMo[index_2][index_2] *
oP[index_2]);
328 X0 = cMo[index_0][index_3] + (cMo[index_0][0] *
oP[index_3]) + (cMo[index_0][1] *
oP[index_4]) + (cMo[index_0][index_2] *
oP[index_5]);
329 Y0 = cMo[index_1][index_3] + (cMo[index_1][0] *
oP[index_3]) + (cMo[index_1][1] *
oP[index_4]) + (cMo[index_1][index_2] *
oP[index_5]);
330 Z0 = cMo[index_2][index_3] + (cMo[index_2][0] *
oP[index_3]) + (cMo[index_2][1] *
oP[index_4]) + (cMo[index_2][index_2] *
oP[index_5]);
459 const double &theta,
double &i,
double &j)
462 double px = cam.get_px();
463 double py = cam.get_py();
464 double u0 = cam.get_u0();
465 double v0 = cam.get_v0();
467 const unsigned int index_0 = 0;
468 const unsigned int index_1 = 1;
469 const unsigned int index_2 = 2;
470 const unsigned int index_3 = 3;
471 const unsigned int index_4 = 4;
473 double n11 = circle.
p[index_3];
474 double n02 = circle.
p[index_4];
475 double n20 = circle.
p[index_2];
476 double Xg = u0 + (circle.
p[index_0] * px);
477 double Yg = v0 + (circle.
p[index_1] * py);
482 double stheta = sin(theta);
483 double ctheta = cos(theta);
484 double sctheta = stheta * ctheta;
485 double m11yg = n11 * Yg;
487 double m02xg = n02 * Xg;
488 double m11stheta = n11 * stheta;
489 j = ((((((((n11 * Xg * sctheta) - (n20 * Yg * sctheta)) + (n20 * rho * ctheta)) - m11yg) + (m11yg * ctheta2) + m02xg) -
490 (m02xg * ctheta2)) + (m11stheta * rho)) /
491 (((n20 * ctheta2) + (2.0 * m11stheta * ctheta) + n02) - (n02 * ctheta2)));
493 double rhom02 = rho * n02;
494 double sctheta2 = stheta * ctheta2;
495 double ctheta3 = ctheta2 * ctheta;
496 i = (-(((((((-rho * n11 * stheta * ctheta) - rhom02) + (rhom02 * ctheta2) + (n11 * Xg * sctheta2)) - (n20 * Yg * sctheta2)) -
497 (ctheta * n11 * Yg)) + (ctheta3 * n11 * Yg) + (ctheta * n02 * Xg)) - (ctheta3 * n02 * Xg)) /
498 (((n20 * ctheta2) + (2.0 * n11 * stheta * ctheta) + n02) - (n02 * ctheta2)) / stheta);
static void computeIntersectionPoint(const vpCircle &circle, const vpCameraParameters &cam, const double &rho, const double &theta, double &i, double &j)
static void displayEllipse(double x, double y, double n20, double n11, double n02, const vpCameraParameters &cam, const vpImage< unsigned char > &I, const vpColor &color=vpColor::green, unsigned int thickness=1)