39 #include <visp3/core/vpCircle.h> 41 #include <visp3/core/vpFeatureDisplay.h> 177 double s = X0 * X0 + Y0 * Y0 + Z0 * Z0 - r * r;
178 double det = A * X0 + B * Y0 + C * Z0;
183 K[0] = 1 - 2 * A * X0 + A * A * s;
184 K[1] = 1 - 2 * B * Y0 + B * B * s;
185 K[2] = -A * Y0 - B * X0 + A * B * s;
186 K[3] = -C * X0 - A * Z0 + A * C * s;
187 K[4] = -C * Y0 - B * Z0 + B * C * s;
188 K[5] = 1 - 2 * C * Z0 + C * C * s;
191 double det = K[2] * K[2] - K[0] * K[1];
192 if (fabs(det) < 1e-8) {
196 double xc = (K[1] * K[3] - K[2] * K[4]) / det;
197 double yc = (K[0] * K[4] - K[2] * K[3]) / det;
199 double c = sqrt((K[0] - K[1]) * (K[0] - K[1]) + 4 * K[2] * K[2]);
200 double s = 2 * (K[0] * xc * xc + 2 * K[2] * xc * yc + K[1] * yc * yc - K[5]);
204 if (fabs(K[2]) < std::numeric_limits<double>::epsilon()) {
207 A = sqrt(s / (K[0] + K[1] + c));
208 B = sqrt(s / (K[0] + K[1] - c));
210 A = sqrt(s / (K[0] + K[1] - c));
211 B = sqrt(s / (K[0] + K[1] + c));
214 E = (K[1] - K[0] + c) / (2 * K[2]);
216 A = sqrt(s / (K[0] + K[1] + c));
217 B = sqrt(s / (K[0] + K[1] - c));
219 A = sqrt(s / (K[0] + K[1] - c));
220 B = sqrt(s / (K[0] + K[1] + c));
250 A = cMo[0][0] *
oP[0] + cMo[0][1] *
oP[1] + cMo[0][2] *
oP[2];
251 B = cMo[1][0] * oP[0] + cMo[1][1] * oP[1] + cMo[1][2] * oP[2];
252 C = cMo[2][0] * oP[0] + cMo[2][1] * oP[1] + cMo[2][2] * oP[2];
255 X0 = cMo[0][3] + cMo[0][0] * oP[3] + cMo[0][1] * oP[4] + cMo[0][2] * oP[5];
256 Y0 = cMo[1][3] + cMo[1][0] * oP[3] + cMo[1][1] * oP[4] + cMo[1][2] * oP[5];
257 Z0 = cMo[2][3] + cMo[2][0] * oP[3] + cMo[2][1] * oP[4] + cMo[2][2] * oP[5];
280 A = cMo[0][0] *
oP[0] + cMo[0][1] *
oP[1] + cMo[0][2] *
oP[2];
281 B = cMo[1][0] * oP[0] + cMo[1][1] * oP[1] + cMo[1][2] * oP[2];
282 C = cMo[2][0] * oP[0] + cMo[2][1] * oP[1] + cMo[2][2] * oP[2];
285 X0 = cMo[0][3] + cMo[0][0] * oP[3] + cMo[0][1] * oP[4] + cMo[0][2] * oP[5];
286 Y0 = cMo[1][3] + cMo[1][0] * oP[3] + cMo[1][1] * oP[4] + cMo[1][2] * oP[5];
287 Z0 = cMo[2][3] + cMo[2][0] * oP[3] + cMo[2][1] * oP[4] + cMo[2][2] * oP[5];
310 unsigned int thickness)
327 const vpColor &color,
unsigned int thickness)
359 const double &theta,
double &i,
double &j)
367 double n11 = circle.
p[3];
368 double n02 = circle.
p[4];
369 double n20 = circle.
p[2];
370 double Xg = u0 + circle.
p[0] * px;
371 double Yg = v0 + circle.
p[1] * py;
376 double stheta = sin(theta);
377 double ctheta = cos(theta);
378 double sctheta = stheta * ctheta;
379 double m11yg = n11 * Yg;
381 double m02xg = n02 * Xg;
382 double m11stheta = n11 * stheta;
383 j = ((n11 * Xg * sctheta - n20 * Yg * sctheta + n20 * rho * ctheta - m11yg + m11yg * ctheta2 + m02xg -
384 m02xg * ctheta2 + m11stheta * rho) /
385 (n20 * ctheta2 + 2.0 * m11stheta * ctheta + n02 - n02 * ctheta2));
387 double rhom02 = rho * n02;
388 double sctheta2 = stheta * ctheta2;
389 double ctheta3 = ctheta2 * ctheta;
390 i = (-(-rho * n11 * stheta * ctheta - rhom02 + rhom02 * ctheta2 + n11 * Xg * sctheta2 - n20 * Yg * sctheta2 -
391 ctheta * n11 * Yg + ctheta3 * n11 * Yg + ctheta * n02 * Xg - ctheta3 * n02 * Xg) /
392 (n20 * ctheta2 + 2.0 * n11 * stheta * ctheta + n02 - n02 * ctheta2) / stheta);
void display(const vpImage< unsigned char > &I, const vpCameraParameters &cam, const vpColor &color=vpColor::green, unsigned int thickness=1)
Implementation of an homogeneous matrix and operations on such kind of matrices.
Class to define RGB colors available for display functionnalities.
error that can be emited by ViSP classes.
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)
static double sqr(double x)
static void computeIntersectionPoint(const vpCircle &circle, const vpCameraParameters &cam, const double &rho, const double &theta, double &i, double &j)
vpCircle * duplicate() const
for memory issue (used by the vpServo class only)
Generic class defining intrinsic camera parameters.
void resize(unsigned int i, bool flagNullify=true)
Implementation of column vector and the associated operations.
Class that defines a 3D circle in the object frame and allows forward projection of a 3D circle in th...
void changeFrame(const vpHomogeneousMatrix &cMo, vpColVector &cP) const
void setWorldCoordinates(const vpColVector &oP)