43 #include <visp/vpConfig.h>
44 #ifndef DOXYGEN_SHOULD_SKIP_THIS
46 #include <visp/vpPlotGraph.h>
47 #include <visp/vpMath.h>
48 #include <visp/vpMeterPixelConversion.h>
49 #include <visp/vpPixelMeterConversion.h>
50 #include <visp/vpPose.h>
52 #include <visp/vpDisplayOpenCV.h>
53 #include <visp/vpDisplayX.h>
54 #include <visp/vpDisplayGDI.h>
55 #include <visp/vpDisplayGTK.h>
56 #include <visp/vpDisplayD3D.h>
59 #include <visp/vpMath.h>
62 #if defined(VISP_HAVE_DISPLAY)
64 int laFonctionSansNom (
const double delta);
68 vpPlotGraph::vpPlotGraph()
69 : xorg(0.), yorg(0.), zoomx(1.), zoomy(1.), xmax(10), ymax(10), xmin(0), ymin(-10),
70 xdelt(1), ydelt(1), gridx(true), gridy(true), gridColor(), curveNbr(1), curveList(NULL),
71 scaleInitialized(false), firstPoint(true), nbDivisionx(10), nbDivisiony(10), topLeft(),
72 width(0), height(0), graphZone(), dTopLeft(), dWidth(0), dHeight(0), dGraphZone(),
73 dTopLeft3D(), dGraphZone3D(), cam(), cMo(), cMf(), w_xval(0), w_xsize(0), w_yval(0), w_ysize(0),
74 w_zval(0), w_zsize(0), ptXorg(0), ptYorg(0), ptZorg(0), zoomx_3D(1.), zoomy_3D(1.), zoomz_3D(1.),
75 nbDivisionz(10), zorg(1.), zoomz(1.), zmax(10), zmin(-10), zdelt(1), old_iPr(), old_iPz(),
76 blockedr(false), blockedz(false), blocked(false), epsi(5), epsj(6),
77 dispUnit(false), dispTitle(false), dispLegend(false), gridThickness(1)
79 gridColor.setColor(200,200,200);
87 vpPlotGraph::~vpPlotGraph()
89 if (curveList != NULL)
97 vpPlotGraph::initGraph (
unsigned int nbCurve)
99 curveList =
new vpPlotCurve[nbCurve];
104 for (
unsigned int i = 0; i < curveNbr; i++)
106 (curveList+i)->color = colors[i%6];
107 (curveList+i)->curveStyle = line;
108 (curveList+i)->pointListx.clear();
109 (curveList+i)->pointListy.clear();
110 strcpy((curveList+i)->legend,
"");
115 vpPlotGraph::initSize (
vpImagePoint top_left,
unsigned int w,
unsigned int h,
unsigned int margei,
unsigned int margej)
117 this->topLeft = top_left;
120 graphZone.setTopLeft(topLeft);
121 graphZone.setWidth(width);
122 graphZone.setHeight(height);
124 this->dTopLeft =
vpImagePoint(topLeft.get_i()+margei,topLeft.get_j()+margej);
125 this->dWidth = width-margej-10;
126 this->dHeight = height-2*margei;
127 dGraphZone.setTopLeft(dTopLeft);
128 dGraphZone.setWidth(dWidth+1);
129 dGraphZone.setHeight(dHeight+1);
131 this->dTopLeft3D =
vpImagePoint(topLeft.get_i()+margei,topLeft.get_j()+10);
132 dGraphZone3D.setTopLeft(dTopLeft3D);
133 dGraphZone3D.setWidth(dWidth+1);
134 dGraphZone3D.setHeight(dHeight+1);
136 if (this->dWidth > this->dHeight)
139 w_xsize = this->dWidth/this->dHeight;
142 w_yval = w_ysize/2.0;
143 w_xval = w_xsize/2.0;
144 w_zval = w_zsize/2.0;
146 else if (this->dWidth == this->dHeight)
156 else if (this->dWidth < this->dHeight)
159 w_ysize = this->dHeight/this->dWidth;
162 w_yval = w_ysize/2.0;
163 w_xval = w_xsize/2.0;
164 w_zval = w_zsize/2.0;
171 cMf.buildFrom(0,0,cMo[2][3],0,0,0);
176 vpPlotGraph::findPose()
187 iP[2].
set_ij(dHeight-1,dWidth-1);
188 iP[3].
set_ij(dHeight-1,0);
194 for (
unsigned int i=0 ; i < 4 ; i++)
207 vpPlotGraph::computeGraphParameters()
209 zoomx = dWidth/(xmax-xmin);
210 zoomy = dHeight/(ymax-ymin);
211 xorg = dTopLeft.
get_j() - (xmin*zoomx);
212 yorg = dTopLeft.get_i() + (ymax*zoomy);
216 vpPlotGraph::setCurveColor(
const unsigned int curveNum,
const vpColor color)
218 (curveList+curveNum)->color = color;
222 vpPlotGraph::setTitle (
const char *title_)
224 if (strlen(title_) >= 256) {
226 "Not enough memory to intialize the title"));
229 strcpy(this->title, title_);
234 vpPlotGraph::setUnitX (
const char *unit_x)
236 if (strlen(unit_x) >= 256) {
238 "Not enough memory to intialize the unit along x axis"));
241 strcpy(this->unitx, unit_x);
246 vpPlotGraph::setUnitY (
const char *unit_y)
248 if (strlen(unit_y) >= 256) {
250 "Not enough memory to intialize the unit along y axis"));
253 strcpy(this->unity, unit_y);
258 vpPlotGraph::setUnitZ (
const char *unit_z)
260 if (strlen(unit_z) >= 256) {
262 "Not enough memory to intialize the unit along z axis"));
265 strcpy(this->unitz, unit_z);
270 vpPlotGraph::setLegend (
const unsigned int curveNum,
const char *legend)
272 if (strlen(legend) >= 256) {
274 "Not enough memory to intialize the legend"));
277 strcpy((curveList+curveNum)->legend,legend);
282 vpPlotGraph::setCurveThickness(
const unsigned int curveNum,
const unsigned int thickness)
284 (curveList+curveNum)->thickness = thickness;
288 laFonctionSansNom (
const double delta)
320 computeGraphParameters();
322 xdelt = (xmax-xmin)/nbDivisionx;
323 ydelt = (ymax-ymin)/nbDivisiony;
329 power = laFonctionSansNom(xdelt);
330 for(t=xmin;t<=xmax;t=t+xdelt)
332 double x = xorg+(zoomx*t);
338 if (t+xdelt <= xmax+1e-10)
342 ttemp = t*pow(10.0,power);
344 sprintf(valeur,
"%.2f", ttemp);
345 #if defined VISP_HAVE_X11
347 #elif defined (VISP_HAVE_GDI) || defined (VISP_HAVE_OPENCV) || defined(VISP_HAVE_D3D9) || defined(VISP_HAVE_GTK)
354 sprintf(valeur,
"x10e%d", -power);
355 #if defined VISP_HAVE_X11
357 #elif defined (VISP_HAVE_GDI) || defined (VISP_HAVE_OPENCV) || defined(VISP_HAVE_D3D9) || defined(VISP_HAVE_GTK)
362 power = laFonctionSansNom(ydelt);
363 for(t=ymin;t<=ymax;t=t+ydelt)
365 double y = yorg-(zoomy*t);
373 ttemp = t*pow(10.0,power);
376 sprintf(valeur,
"%.2f", ttemp);
377 #if defined VISP_HAVE_X11
379 #elif defined (VISP_HAVE_GDI) || defined (VISP_HAVE_OPENCV) || defined(VISP_HAVE_D3D9) || defined(VISP_HAVE_GTK)
385 sprintf(valeur,
"x10e%d", -power);
386 #if defined VISP_HAVE_X11
388 #elif defined (VISP_HAVE_GDI) || defined (VISP_HAVE_OPENCV) || defined(VISP_HAVE_D3D9) || defined(VISP_HAVE_GTK)
410 #
if defined(VISP_HAVE_X11) || defined (VISP_HAVE_GDI) || defined(VISP_HAVE_OPENCV) || defined(VISP_HAVE_D3D9) || defined(VISP_HAVE_GTK)
415 unsigned int offsetx = vpMath::minimum<unsigned int>((
unsigned int)strlen(unitx), dWidth);
417 #if defined VISP_HAVE_X11
420 #elif defined (VISP_HAVE_GDI) || defined (VISP_HAVE_OPENCV) || defined(VISP_HAVE_D3D9) || defined(VISP_HAVE_GTK)
429 double size = (double)strlen(title);
433 dTopLeft.get_j()+dWidth/2.0-4*size),
442 for (
unsigned int i = 0; i < curveNbr; i++) {
443 size_t offset = epsj * strlen((curveList+i)->legend);
446 if (offsetj > dWidth) offsetj = dWidth;
448 for (
unsigned int i = 0; i < curveNbr; i++) {
451 dTopLeft.get_j()+dWidth-offsetj),
452 (curveList+i)->legend,
453 (curveList+i)->color);
458 vpPlotGraph::rescalex(
unsigned int side,
double extremity)
463 xmin = (3*extremity-xmax)/2;
466 xmax = (3*extremity-xmin)/2;
470 xdelt = (xmax-xmin)/(
double)nbDivisionx;
474 vpPlotGraph::rescaley(
unsigned int side,
double extremity)
479 ymin = (3*extremity-ymax)/2;
482 ymax = (3*extremity-ymin)/2;
486 ydelt = (ymax-ymin)/(
double)nbDivisiony;
490 vpPlotGraph::initScale(
vpImage<unsigned char> &I,
const double x_min,
const double x_max,
const int nbDivx,
491 const double y_min,
const double y_max,
const int nbDivy,
const bool gx,
const bool gy)
499 this->nbDivisionx = nbDivx;
500 this->nbDivisiony = nbDivy;
501 computeGraphParameters();
505 scaleInitialized =
true;
510 vpPlotGraph::initScale(
vpImage<unsigned char> &I,
const double x_min,
const double x_max,
const int nbDivx,
511 const double y_min,
const double y_max,
const int nbDivy,
512 const double z_min,
const double z_max,
const int nbDivz,
const bool gx,
const bool gy)
522 this->nbDivisionx = nbDivx;
523 this->nbDivisiony = nbDivy;
524 this->nbDivisionz = nbDivz;
525 computeGraphParameters();
529 scaleInitialized =
true;
535 if (!scaleInitialized)
557 scaleInitialized =
true;
558 computeGraphParameters();
562 if (std::fabs(y) <= std::numeric_limits<double>::epsilon())
563 scaleInitialized =
false;
575 double i = yorg-(zoomy*y);
576 double j = xorg+(zoomx*x);
582 if (x > xmax) rescalex(1,x);
583 else if(x < xmin) rescalex(0,x);
585 if (y > ymax) rescaley(1,y);
586 else if(y < ymin) rescaley(0,y);
588 computeGraphParameters();
597 (curveList+curveNb)->plotPoint(I, iP, x, y);
598 #if (!defined VISP_HAVE_X11 && defined FLUSH_ON_PLOT)
609 for (
unsigned int i = 0; i < curveNbr; i++)
610 (curveList+i)->plotList(I,xorg,yorg,zoomx,zoomy);
625 double x = (iP.
get_j()-xorg)/zoomx;
626 double y = (yorg-iP.
get_i())/zoomy;
630 sprintf(valeur,
" x: %f", x);
632 sprintf(valeur,
" y: %f", y);
642 vpPlotGraph::resetPointList(
const unsigned int curveNum)
644 (curveList+curveNum)->pointListx.clear();
645 (curveList+curveNum)->pointListy.clear();
646 (curveList+curveNum)->pointListz.clear();
647 (curveList+curveNum)->nbPoint = 0;
660 if (!iP1In || !iP2In)
662 double dTopLeft_i = dTopLeft3D.get_i();
663 double dTopLeft_j = dTopLeft3D.get_j();
664 double dBottomRight_i = dTopLeft_i+dHeight;
665 double dBottomRight_j = dTopLeft_j+dWidth;
672 if (!iP1In && !iP2In)
674 if (iP1.
get_i() < dTopLeft_i && iP2.
get_i() < dTopLeft_i)
676 if (iP1.
get_i() > dBottomRight_i && iP2.
get_i() > dBottomRight_i)
678 if (iP1.
get_j() < dTopLeft_j || iP1.
get_j() > dBottomRight_j)
680 if (iP1.
get_i() < dTopLeft_i) iP1.
set_i(dTopLeft_i);
681 else iP1.
set_i(dBottomRight_i);
682 if (iP2.
get_i() < dTopLeft_i) iP2.
set_i(dTopLeft_i);
683 else iP2.
set_i(dBottomRight_i);
687 if (iP1.
get_j() < dTopLeft_j) iP1.
set_j(dTopLeft_j);
688 if (iP1.
get_j() > dBottomRight_j) iP1.
set_j(dBottomRight_j);
689 if (iP1.
get_i() < dTopLeft_i) iP1.
set_i(dTopLeft_i);
690 if (iP1.
get_i() > dBottomRight_i) iP1.
set_i(dBottomRight_i);
695 if (iP2.
get_j() < dTopLeft_j) iP2.
set_j(dTopLeft_j);
696 if (iP2.
get_j() > dBottomRight_j) iP2.
set_j(dBottomRight_j);
697 if (iP2.
get_i() < dTopLeft_i) iP2.
set_i(dTopLeft_i);
698 if (iP2.
get_i() > dBottomRight_i) iP2.
set_i(dBottomRight_i);
705 if (!iP1In && !iP2In)
707 if (iP1.
get_j() < dTopLeft_j && iP2.
get_j() < dTopLeft_j)
709 if (iP1.
get_j() > dBottomRight_j && iP2.
get_j() > dBottomRight_j)
711 if (iP1.
get_i() < dTopLeft_i || iP1.
get_i() > dBottomRight_i)
713 if (iP1.
get_j() < dTopLeft_j) iP1.
set_j(dTopLeft_j);
714 else iP1.
set_j(dBottomRight_j);
715 if (iP2.
get_j() < dTopLeft_j) iP2.
set_j(dTopLeft_j);
716 else iP2.
set_j(dBottomRight_j);
720 if (iP1.
get_j() < dTopLeft_j) iP1.
set_j(dTopLeft_j);
721 if (iP1.
get_j() > dBottomRight_j) iP1.
set_j(dBottomRight_j);
722 if (iP1.
get_i() < dTopLeft_i) iP1.
set_i(dTopLeft_i);
723 if (iP1.
get_i() > dBottomRight_i) iP1.
set_i(dBottomRight_i);
728 if (iP2.
get_j() < dTopLeft_j) iP2.
set_j(dTopLeft_j);
729 if (iP2.
get_j() > dBottomRight_j) iP2.
set_j(dBottomRight_j);
730 if (iP2.
get_i() < dTopLeft_i) iP2.
set_i(dTopLeft_i);
731 if (iP2.
get_i() > dBottomRight_i) iP2.
set_i(dBottomRight_i);
740 double jtop = (dTopLeft_i-b)/a;
741 double jlow = (dBottomRight_i-b)/a;
743 double ileft = dTopLeft_j*a+b;
744 double iright = (dBottomRight_j)*a+b;
749 if(jtop >= dTopLeft_j && jtop <= dBottomRight_j)
751 iP[n].
set_ij(dTopLeft_i,jtop);
754 if(jlow >= dTopLeft_j && jlow <= dBottomRight_j)
756 iP[n].
set_ij(dBottomRight_i,jlow);
759 if(ileft >= dTopLeft_i && ileft <= dBottomRight_i && n <2)
761 iP[n].
set_ij(ileft,dTopLeft_j);
764 if(iright >= dTopLeft_i && iright <= dBottomRight_i && n <2)
766 iP[n].
set_ij(iright,dBottomRight_j);
773 if (!iP1In && !iP2In)
782 iP1 = iP[0]; iP2 = iP[1];
786 iP1 = iP[1]; iP2 = iP[0];
796 iP1 = iP[0];iP2 = iP[1];
800 iP1 = iP[1];iP2 = iP[0];
810 if (fabs(iP[0].get_j()-iP2.
get_j()) > 5)
824 if (fabs(iP[0].get_i()-iP2.
get_i()) > 5)
847 if (fabs(iP[0].get_j()-iP1.
get_j()) > 5)
861 if (fabs(iP[0].get_i()-iP1.
get_i()) > 5)
887 if (iP.
get_i() < dTopLeft3D.get_i())
888 iP.
set_i(dTopLeft3D.get_i());
889 else if (iP.
get_i() > dTopLeft3D.get_i()+dHeight)
890 iP.
set_i(dTopLeft3D.get_i()+dHeight-1);
891 if (iP.
get_j() <dTopLeft3D.get_j())
892 iP.
set_j(dTopLeft3D.get_j());
893 else if (iP.
get_j() > dTopLeft3D.get_j()+dWidth)
894 iP.
set_j(dTopLeft3D.get_j()+dWidth-1);
901 vpPlotGraph::computeGraphParameters3D()
903 zoomx_3D = w_xsize/(xmax-xmin);
904 zoomy_3D = w_ysize/(ymax-ymin);
905 zoomz_3D = w_zsize/(zmax-zmin);
906 ptXorg = w_xval - zoomx_3D*xmax;
907 ptYorg = w_yval + zoomy_3D*ymin;
908 ptZorg = w_zval - zoomz_3D*zmax;
930 computeGraphParameters3D();
932 xdelt = (xmax-xmin)/nbDivisionx;
933 ydelt = (ymax-ymin)/nbDivisiony;
934 zdelt = (zmax-zmin)/nbDivisionz;
945 for (
unsigned int i = 0; i < 6; i++)
951 iP[i] = iP[i] + dTopLeft3D;
965 power = laFonctionSansNom(xdelt);
968 if (std::fabs(iP[0].get_j()-iP[1].get_j()) >
969 vpMath::maximum(std::fabs(iP[0].get_j()), std::fabs(iP[1].get_j()))* std::numeric_limits<double>::epsilon())
970 pente = fabs((iP[0].get_i()-iP[1].get_i())/(iP[0].get_j()-iP[1].get_j()));
973 unsigned int count = 1;
974 for(t=xmin;t<=xmax;t=t+xdelt)
976 double x = ptXorg+(zoomx_3D*t);
982 iPunit = iPunit + dTopLeft3D;
984 getGrid3DPoint(pente,iPunit,ip1,ip2,ip3);
986 if(check3Dline(ip1,ip2))
993 ttemp = t*pow(10.0,power);
995 sprintf(valeur,
"%.1f", ttemp);
1004 sprintf(valeur,
"x10e%d", -power);
1005 if(check3Dpoint(ip4))
1009 power = laFonctionSansNom(ydelt);
1012 if (std::fabs(iP[2].get_j()-iP[3].get_j()) >
1013 vpMath::maximum(std::fabs(iP[2].get_j()), std::fabs(iP[3].get_j()))* std::numeric_limits<double>::epsilon())
1014 pente = fabs((iP[2].get_i()-iP[3].get_i())/(iP[2].get_j()-iP[3].get_j()));
1017 for(t=ymin;t<=ymax;t=t+ydelt)
1019 double y = ptYorg-(zoomy_3D*t);
1022 double u=0.0, v=0.0;
1025 iPunit = iPunit + dTopLeft3D;
1027 getGrid3DPoint(pente,iPunit,ip1,ip2,ip3);
1029 if(check3Dline(ip1,ip2))
1036 ttemp = t*pow(10.0,power);
1038 sprintf(valeur,
"%.1f", ttemp);
1047 sprintf(valeur,
"x10e%d", -power);
1048 if(check3Dpoint(ip4))
1052 power = laFonctionSansNom(zdelt);
1055 if (std::fabs(iP[4].get_j()-iP[5].get_j()) >
1056 vpMath::maximum(std::fabs(iP[4].get_j()), std::fabs(iP[5].get_j()))* std::numeric_limits<double>::epsilon())
1057 pente = fabs((iP[4].get_i()-iP[5].get_i())/(iP[4].get_j()-iP[5].get_j()));
1060 for(t=zmin;t<=zmax;t=t+zdelt)
1062 double z = ptZorg+(zoomz_3D*t);
1065 double u=0.0, v=0.0;
1068 iPunit = iPunit + dTopLeft3D;
1070 getGrid3DPoint(pente,iPunit,ip1,ip2,ip3);
1072 if(check3Dline(ip1,ip2))
1079 ttemp = t*pow(10.0,power);
1081 sprintf(valeur,
"%.1f", ttemp);
1090 sprintf(valeur,
"x10e%d", -power);
1091 if(check3Dpoint(ip4))
1097 if (check3Dline(iP[0],iP[1]))
1102 iPunit.
set_ij(iP[1].get_i(),iP[1].get_j()-10*epsj);
1103 check3Dpoint (iPunit);
1107 if (check3Dline(iP[3],iP[2]))
1112 iPunit.
set_ij(iP[2].get_i(),iP[2].get_j()-10*epsj);
1113 check3Dpoint (iPunit);
1117 if (check3Dline(iP[4],iP[5]))
1122 iPunit.
set_ij(iP[5].get_i(),iP[5].get_j()-10*epsj);
1123 check3Dpoint (iPunit);
1135 vpPlotGraph::plot (
vpImage<unsigned char> &I,
const unsigned int curveNb,
const double x,
const double y,
const double z)
1137 if (!scaleInitialized)
1169 scaleInitialized =
true;
1170 computeGraphParameters3D();
1174 if (std::fabs(y) <= std::numeric_limits<double>::epsilon() || std::fabs(z) <= std::numeric_limits<double>::epsilon())
1175 scaleInitialized =
false;
1186 bool changed =
false;
1187 if (x > xmax) {rescalex(1,x); changed =
true;}
1188 else if(x < xmin) {rescalex(0,x);changed =
true;}
1190 if (y > ymax) {rescaley(1,y);changed =
true;}
1191 else if(y < ymin) {rescaley(0,y);changed =
true;}
1193 if (z > zmax) {rescalez(1,z);changed =
true;}
1194 else if(z < zmin) {rescalez(0,z);changed =
true;}
1196 if (changed || move(I))
1198 computeGraphParameters3D();
1203 pointPlot.
setWorldCoordinates(ptXorg+(zoomx_3D*x),ptYorg-(zoomy_3D*y),ptZorg+(zoomz_3D*z));
1204 pointPlot.
track(cMo);
1205 double u=0.0, v=0.0;
1209 iP = iP + dTopLeft3D;
1211 (curveList+curveNb)->pointListx.end();
1212 (curveList+curveNb)->pointListy.end();
1213 (curveList+curveNb)->pointListz.end();
1214 if((curveList+curveNb)->nbPoint)
1216 if (check3Dline((curveList+curveNb)->lastPoint,iP))
1217 vpDisplay::displayLine(I,(curveList+curveNb)->lastPoint, iP, (curveList+curveNb)->color, (curveList+curveNb)->thickness);
1219 #if( defined VISP_HAVE_X11 || defined VISP_HAVE_GDI )
1225 if (iP.get_i() <= (curveList+curveNb)->lastPoint.get_i()) {top = iP.get_i()-5; height_ = (curveList+curveNb)->lastPoint.get_i() - top+10;}
1226 else {top = (curveList+curveNb)->lastPoint.get_i()-5; height_ = iP.get_i() - top+10;}
1227 if (iP.get_j() <= (curveList+curveNb)->lastPoint.get_j()) {left = iP.get_j()-5; width_ = (curveList+curveNb)->lastPoint.get_j() - left+10;}
1228 else {left = (curveList+curveNb)->lastPoint.get_j()-5; width_ = iP.get_j() - left+10;}
1232 (curveList+curveNb)->lastPoint = iP;
1233 (curveList+curveNb)->pointListx.push_back(x);
1234 (curveList+curveNb)->pointListy.push_back(y);
1235 (curveList+curveNb)->pointListz.push_back(z);
1236 (curveList+curveNb)->nbPoint++;
1239 #if( !defined VISP_HAVE_X11 && defined FLUSH_ON_PLOT)
1250 for (
unsigned int i = 0; i < curveNbr; i++)
1252 std::list<double>::const_iterator it_ptListx = (curveList+i)->pointListx.begin();
1253 std::list<double>::const_iterator it_ptListy = (curveList+i)->pointListy.begin();
1254 std::list<double>::const_iterator it_ptListz = (curveList+i)->pointListz.begin();
1260 while (k < (curveList+i)->nbPoint)
1265 pointPlot.
setWorldCoordinates(ptXorg+(zoomx_3D*x),ptYorg-(zoomy_3D*y),ptZorg+(zoomz_3D*z));
1266 pointPlot.
track(cMo);
1267 double u=0.0, v=0.0;
1270 iP = iP + dTopLeft3D;
1275 if (check3Dline((curveList+i)->lastPoint,iP))
1280 (curveList+i)->lastPoint = iP;
1294 vpPlotGraph::rescalez(
unsigned int side,
double extremity)
1299 zmin = (3*extremity-zmax)/2;
1302 zmax = (3*extremity-zmin)/2;
1306 zdelt = (zmax-zmin)/(
double)nbDivisionz;
1312 bool changed =
false;
1316 if (std::fabs(displacement[2][3]) > std::numeric_limits<double>::epsilon())
1317 cMf = cMf*displacement;
1320 cMo = cMf* displacement * fMo;
1329 bool clicked =
false;
1330 bool clickedUp =
false;
1367 if (!(blockedr || blockedz))
1383 double diffi = iP.
get_i() - old_iPr.get_i();
1384 double diffj = iP.
get_j() - old_iPr.get_j();
1386 anglei = diffi*360/width_;
1387 anglej = diffj*360/width_;
1392 if (blockedr) old_iPr = iP;
1396 double diffi = iP.
get_i() - old_iPz.get_i();
1397 mov.buildFrom(0,0,diffi*0.01,0,0,0);
1401 if (blockedz) old_iPz = iP;
bool inRectangle(const vpRect &rect) const
virtual void displayArrow(const vpImagePoint &ip1, const vpImagePoint &ip2, const vpColor &color=vpColor::white, unsigned int w=4, unsigned int h=2, unsigned int thickness=1)=0
unsigned int getWidth() const
The class provides a data structure for the homogeneous matrices as well as a set of operations on th...
static const vpColor black
static void convertPoint(const vpCameraParameters &cam, const double &x, const double &y, double &u, double &v)
Point coordinates conversion from normalized coordinates in meter to pixel coordinates ...
Class to define colors available for display functionnalities.
virtual bool getClickUp(vpImagePoint &ip, vpMouseButton::vpMouseButtonType &button, bool blocking=true)=0
error that can be emited by ViSP classes.
void set_x(const double x)
Set the point x coordinate in the image plane.
void track(const vpHomogeneousMatrix &cMo)
static void convertPoint(const vpCameraParameters &cam, const double &u, const double &v, double &x, double &y)
Point coordinates conversion from pixel coordinates to normalized coordinates in meter...
double get_y() const
Get the point y coordinate in the image plane.
static const vpColor green
void set_oX(const double X)
Set the point X coordinate in the object frame.
Class that defines what is a point.
static Type maximum(const Type &a, const Type &b)
static const vpColor orange
void initPersProjWithoutDistortion(const double px, const double py, const double u0, const double v0)
void set_i(const double ii)
static const vpColor cyan
void set_oZ(const double Z)
Set the point Z coordinate in the object frame.
virtual bool getPointerPosition(vpImagePoint &ip)=0
Class used for pose computation from N points (pose from point only).
void set_y(const double y)
Set the point y coordinate in the image plane.
double get_x() const
Get the point x coordinate in the image plane.
static Type minimum(const Type &a, const Type &b)
static double rad(double deg)
virtual void displayDotLine(const vpImagePoint &ip1, const vpImagePoint &ip2, const vpColor &color, unsigned int thickness=1)=0
void set_j(const double jj)
virtual void displayCharString(const vpImagePoint &ip, const char *text, const vpColor &color=vpColor::green)=0
vpHomogeneousMatrix inverse() const
unsigned int getHeight() const
void set_uv(const double u, const double v)
Defines a rectangle in the plane.
static void flushROI(const vpImage< unsigned char > &I, const vpRect &roi)
void computePose(vpPoseMethodType methode, vpHomogeneousMatrix &cMo)
compute the pose for a given method
static void displayROI(const vpImage< unsigned char > &I, const vpRect &roi)
virtual bool getClick(bool blocking=true)=0
Class that defines a 2D point in an image. This class is useful for image processing and stores only ...
virtual void displayLine(const vpImagePoint &ip1, const vpImagePoint &ip2, const vpColor &color, unsigned int thickness=1)=0
static int sign(double x)
void addPoint(const vpPoint &P)
Add a new point in this array.
static const vpColor purple
static double distance(const vpImagePoint &iP1, const vpImagePoint &iP2)
void set_ij(const double ii, const double jj)
static const vpColor blue
void setWorldCoordinates(const double ox, const double oy, const double oz)
Set the point world coordinates. We mean here the coordinates of the point in the object frame...
void set_oY(const double Y)
Set the point Y coordinate in the object frame.
void clearPoint()
suppress all the point in the array of point