39 #include <visp3/core/vpCircle.h>
41 #include <visp3/core/vpFeatureDisplay.h>
81 const double X0,
const double Y0,
const double Z0,
130 const double X0,
const double Y0,
188 double s = X0*X0 + Y0*Y0 + Z0*Z0 - r*r ;
189 double det = A*X0+B*Y0+C*Z0;
194 K[0] = 1 - 2*A*X0 + A*A*s;
195 K[1] = 1 - 2*B*Y0 + B*B*s;
196 K[2] = -A*Y0 - B*X0 + A*B*s;
197 K[3] = -C*X0 - A*Z0 + A*C*s;
198 K[4] = -C*Y0 - B*Z0 + B*C*s;
199 K[5] = 1 - 2*C*Z0 + C*C*s;
208 double det = K[2]*K[2] -K[0]*K[1];
209 if (fabs(det) < 1e-8)
216 double xc = (K[1]*K[3]-K[2]*K[4])/det;
217 double yc = (K[0]*K[4]-K[2]*K[3])/det;
219 double c = sqrt( (K[0]-K[1])*(K[0]-K[1]) + 4*K[2]*K[2] );
220 double s = 2*(K[0]*xc*xc + 2*K[2]*xc*yc + K[1]*yc*yc - K[5]);
225 if (fabs(K[2])<std::numeric_limits<double>::epsilon())
230 A = sqrt(s/(K[0] + K[1] + c));
231 B = sqrt(s/(K[0] + K[1] - c));
235 A = sqrt(s/(K[0] + K[1] - c));
236 B = sqrt(s/(K[0] + K[1] + c));
241 E = (K[1] - K[0] + c)/(2*K[2]);
244 A = sqrt(s/(K[0] + K[1] + c));
245 B = sqrt(s/(K[0] + K[1] - c));
249 A = sqrt(s/(K[0] + K[1] - c));
250 B = sqrt(s/(K[0] + K[1] + c));
273 A = cMo[0][0]*
oP[0] + cMo[0][1]*
oP[1] + cMo[0][2]*
oP[2];
274 B = cMo[1][0]*oP[0] + cMo[1][1]*oP[1] + cMo[1][2]*oP[2];
275 C = cMo[2][0]*oP[0] + cMo[2][1]*oP[1] + cMo[2][2]*oP[2];
278 X0 = cMo[0][3] + cMo[0][0]*oP[3] + cMo[0][1]*oP[4] + cMo[0][2]*oP[5];
279 Y0 = cMo[1][3] + cMo[1][0]*oP[3] + cMo[1][1]*oP[4] + cMo[1][2]*oP[5];
280 Z0 = cMo[2][3] + cMo[2][0]*oP[3] + cMo[2][1]*oP[4] + cMo[2][2]*oP[5];
303 A = cMo[0][0]*
oP[0] + cMo[0][1]*
oP[1] + cMo[0][2]*
oP[2];
304 B = cMo[1][0]*oP[0] + cMo[1][1]*oP[1] + cMo[1][2]*oP[2];
305 C = cMo[2][0]*oP[0] + cMo[2][1]*oP[1] + cMo[2][2]*oP[2];
308 X0 = cMo[0][3] + cMo[0][0]*oP[3] + cMo[0][1]*oP[4] + cMo[0][2]*oP[5];
309 Y0 = cMo[1][3] + cMo[1][0]*oP[3] + cMo[1][1]*oP[4] + cMo[1][2]*oP[5];
310 Z0 = cMo[2][3] + cMo[2][0]*oP[3] + cMo[2][1]*oP[4] + cMo[2][2]*oP[5];
330 const unsigned int thickness)
333 cam, I, color, thickness) ;
341 const unsigned int thickness)
347 cam, I, color, thickness) ;
376 double px = cam.
get_px() ;
377 double py = cam.
get_py() ;
378 double u0 = cam.
get_u0() ;
379 double v0 = cam.
get_v0() ;
381 double mu11 = circle.
p[3];
382 double mu02 = circle.
p[4];
383 double mu20 = circle.
p[2];
384 double Xg = u0 + circle.
p[0]*px;
385 double Yg = v0 + circle.
p[1]*py;
390 double stheta = sin(theta);
391 double ctheta = cos(theta);
392 double sctheta = stheta*ctheta;
393 double m11yg = mu11*Yg;
395 double m02xg = mu02*Xg;
396 double m11stheta = mu11*stheta;
397 j = ((mu11*Xg*sctheta-mu20*Yg*sctheta+mu20*rho*ctheta
398 -m11yg+m11yg*ctheta2+m02xg-m02xg*ctheta2+
399 m11stheta*rho)/(mu20*ctheta2+2.0*m11stheta*ctheta
400 +mu02-mu02*ctheta2));
402 double rhom02 = rho*mu02;
403 double sctheta2 = stheta*ctheta2;
404 double ctheta3 = ctheta2*ctheta;
405 i = (-(-rho*mu11*stheta*ctheta-rhom02+rhom02*ctheta2
406 +mu11*Xg*sctheta2-mu20*Yg*sctheta2-ctheta*mu11*Yg
407 +ctheta3*mu11*Yg+ctheta*mu02*Xg-ctheta3*mu02*Xg)/
408 (mu20*ctheta2+2.0*mu11*stheta*ctheta+mu02-
409 mu02*ctheta2)/stheta);
static void displayEllipse(double x, double y, double mu20, double mu11, double m02, const vpCameraParameters &cam, const vpImage< unsigned char > &I, const vpColor &color=vpColor::green, unsigned int thickness=1)
void changeFrame(const vpHomogeneousMatrix &cMo, vpColVector &cP)
perspective projection of the circle
Implementation of an homogeneous matrix and operations on such kind of matrices.
Class to define colors available for display functionnalities.
error that can be emited by ViSP classes.
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 display(const vpImage< unsigned char > &I, const vpCameraParameters &cam, const vpColor &color=vpColor::green, const unsigned int thickness=1)
Implementation of column vector and the associated operations.
Class that defines what is a circle.
void setWorldCoordinates(const vpColVector &oP)
void resize(const unsigned int i, const bool flagNullify=true)