39 #include <visp3/core/vpConfig.h>
40 #ifndef DOXYGEN_SHOULD_SKIP_THIS
42 #include <visp3/gui/vpPlotGraph.h>
43 #include <visp3/core/vpMath.h>
44 #include <visp3/core/vpMeterPixelConversion.h>
45 #include <visp3/core/vpPixelMeterConversion.h>
48 #include <visp3/gui/vpDisplayOpenCV.h>
49 #include <visp3/gui/vpDisplayX.h>
50 #include <visp3/gui/vpDisplayGDI.h>
51 #include <visp3/gui/vpDisplayGTK.h>
52 #include <visp3/gui/vpDisplayD3D.h>
55 #include <visp3/core/vpMath.h>
58 #if defined(VISP_HAVE_DISPLAY)
60 int laFonctionSansNom (
const double delta);
64 vpPlotGraph::vpPlotGraph()
65 : xorg(0.), yorg(0.), zoomx(1.), zoomy(1.), xmax(10), ymax(10), xmin(0), ymin(-10),
66 xdelt(1), ydelt(1), gridx(true), gridy(true), gridColor(), curveNbr(1), curveList(NULL),
67 scaleInitialized(false), firstPoint(true), nbDivisionx(10), nbDivisiony(10), topLeft(),
68 width(0),
height(0), graphZone(), dTopLeft(), dWidth(0), dHeight(0), dGraphZone(),
69 dTopLeft3D(), dGraphZone3D(), cam(), cMo(), cMf(), w_xval(0), w_xsize(0), w_yval(0), w_ysize(0),
70 w_zval(0), w_zsize(0), ptXorg(0), ptYorg(0), ptZorg(0), zoomx_3D(1.), zoomy_3D(1.), zoomz_3D(1.),
71 nbDivisionz(10), zorg(1.), zoomz(1.), zmax(10), zmin(-10), zdelt(1), old_iPr(), old_iPz(),
72 blockedr(false), blockedz(false), blocked(false), epsi(5), epsj(6),
73 dispUnit(false), dispTitle(false), dispLegend(false), gridThickness(1)
75 gridColor.setColor(200,200,200);
83 vpPlotGraph::~vpPlotGraph()
85 if (curveList != NULL)
93 vpPlotGraph::initGraph (
unsigned int nbCurve)
95 curveList =
new vpPlotCurve[nbCurve];
100 for (
unsigned int i = 0; i < curveNbr; i++)
102 (curveList+i)->color = colors[i%6];
103 (curveList+i)->curveStyle = line;
104 (curveList+i)->pointListx.clear();
105 (curveList+i)->pointListy.clear();
106 strcpy((curveList+i)->legend,
"");
111 vpPlotGraph::initSize (
vpImagePoint top_left,
unsigned int w,
unsigned int h,
unsigned int margei,
unsigned int margej)
113 this->topLeft = top_left;
116 graphZone.setTopLeft(topLeft);
117 graphZone.setWidth(
width);
118 graphZone.setHeight(
height);
120 this->dTopLeft =
vpImagePoint(topLeft.get_i()+margei,topLeft.get_j()+margej);
121 this->dWidth =
width-margej-10;
122 this->dHeight =
height-2*margei;
123 dGraphZone.setTopLeft(dTopLeft);
124 dGraphZone.setWidth(dWidth+1);
125 dGraphZone.setHeight(dHeight+1);
127 this->dTopLeft3D =
vpImagePoint(topLeft.get_i()+margei,topLeft.get_j()+10);
128 dGraphZone3D.setTopLeft(dTopLeft3D);
129 dGraphZone3D.setWidth(dWidth+1);
130 dGraphZone3D.setHeight(dHeight+1);
132 if (this->dWidth > this->dHeight)
135 w_xsize = this->dWidth/this->dHeight;
138 w_yval = w_ysize/2.0;
139 w_xval = w_xsize/2.0;
140 w_zval = w_zsize/2.0;
142 else if (this->dWidth == this->dHeight)
152 else if (this->dWidth < this->dHeight)
155 w_ysize = this->dHeight/this->dWidth;
158 w_yval = w_ysize/2.0;
159 w_xval = w_xsize/2.0;
160 w_zval = w_zsize/2.0;
167 cMf.buildFrom(0,0,cMo[2][3],0,0,0);
172 vpPlotGraph::findPose()
183 iP[2].
set_ij(dHeight-1,dWidth-1);
184 iP[3].
set_ij(dHeight-1,0);
192 for (
unsigned int i=0 ; i < 4 ; i++)
206 for(
unsigned int i=0; i< 4; i++) {
216 vpPlotGraph::computeGraphParameters()
218 zoomx = dWidth/(xmax-xmin);
219 zoomy = dHeight/(ymax-ymin);
220 xorg = dTopLeft.
get_j() - (xmin*zoomx);
221 yorg = dTopLeft.get_i() + (ymax*zoomy);
225 vpPlotGraph::setCurveColor(
const unsigned int curveNum,
const vpColor color)
227 (curveList+curveNum)->color = color;
231 vpPlotGraph::setTitle (
const char *
title_)
233 if (strlen(title_) >= 256) {
235 "Not enough memory to intialize the title"));
238 strcpy(this->title, title_);
243 vpPlotGraph::setUnitX (
const char *unit_x)
245 if (strlen(unit_x) >= 256) {
247 "Not enough memory to intialize the unit along x axis"));
250 strcpy(this->unitx, unit_x);
255 vpPlotGraph::setUnitY (
const char *unit_y)
257 if (strlen(unit_y) >= 256) {
259 "Not enough memory to intialize the unit along y axis"));
262 strcpy(this->unity, unit_y);
267 vpPlotGraph::setUnitZ (
const char *unit_z)
269 if (strlen(unit_z) >= 256) {
271 "Not enough memory to intialize the unit along z axis"));
274 strcpy(this->unitz, unit_z);
279 vpPlotGraph::setLegend (
const unsigned int curveNum,
const char *legend)
281 if (strlen(legend) >= 256) {
283 "Not enough memory to intialize the legend"));
286 strcpy((curveList+curveNum)->legend,legend);
291 vpPlotGraph::setCurveThickness(
const unsigned int curveNum,
const unsigned int thickness)
293 (curveList+curveNum)->thickness = thickness;
297 laFonctionSansNom (
const double delta)
329 computeGraphParameters();
331 xdelt = (xmax-xmin)/nbDivisionx;
332 ydelt = (ymax-ymin)/nbDivisiony;
338 power = laFonctionSansNom(xdelt);
339 for(t=xmin;t<=xmax;t=t+xdelt)
341 double x = xorg+(zoomx*t);
347 if (t+xdelt <= xmax+1e-10)
351 ttemp = t*pow(10.0,power);
353 sprintf(valeur,
"%.2f", ttemp);
354 #if defined VISP_HAVE_X11
356 #elif defined (VISP_HAVE_GDI) || defined (VISP_HAVE_OPENCV) || defined(VISP_HAVE_D3D9) || defined(VISP_HAVE_GTK)
363 sprintf(valeur,
"x10e%d", -power);
364 #if defined VISP_HAVE_X11
366 #elif defined (VISP_HAVE_GDI) || defined (VISP_HAVE_OPENCV) || defined(VISP_HAVE_D3D9) || defined(VISP_HAVE_GTK)
371 power = laFonctionSansNom(ydelt);
372 for(t=ymin;t<=ymax;t=t+ydelt)
374 double y = yorg-(zoomy*t);
382 ttemp = t*pow(10.0,power);
385 sprintf(valeur,
"%.2f", ttemp);
386 #if defined VISP_HAVE_X11
388 #elif defined (VISP_HAVE_GDI) || defined (VISP_HAVE_OPENCV) || defined(VISP_HAVE_D3D9) || defined(VISP_HAVE_GTK)
394 sprintf(valeur,
"x10e%d", -power);
395 #if defined VISP_HAVE_X11
397 #elif defined (VISP_HAVE_GDI) || defined (VISP_HAVE_OPENCV) || defined(VISP_HAVE_D3D9) || defined(VISP_HAVE_GTK)
419 #
if defined(VISP_HAVE_X11) || defined (VISP_HAVE_GDI) || defined(VISP_HAVE_OPENCV) || defined(VISP_HAVE_D3D9) || defined(VISP_HAVE_GTK)
424 unsigned int offsetx = vpMath::minimum<unsigned int>((
unsigned int)strlen(unitx), dWidth);
426 #if defined VISP_HAVE_X11
429 #elif defined (VISP_HAVE_GDI) || defined (VISP_HAVE_OPENCV) || defined(VISP_HAVE_D3D9) || defined(VISP_HAVE_GTK)
438 double size = (double)strlen(title);
442 dTopLeft.get_j()+dWidth/2.0-4*size),
451 for (
unsigned int i = 0; i < curveNbr; i++) {
452 size_t offset = epsj * strlen((curveList+i)->legend);
455 if (offsetj > dWidth) offsetj = dWidth;
457 for (
unsigned int i = 0; i < curveNbr; i++) {
460 dTopLeft.get_j()+dWidth-offsetj),
461 (curveList+i)->legend,
462 (curveList+i)->color);
467 vpPlotGraph::rescalex(
unsigned int side,
double extremity)
472 xmin = (3*extremity-xmax)/2;
475 xmax = (3*extremity-xmin)/2;
479 xdelt = (xmax-xmin)/(
double)nbDivisionx;
483 vpPlotGraph::rescaley(
unsigned int side,
double extremity)
488 ymin = (3*extremity-ymax)/2;
491 ymax = (3*extremity-ymin)/2;
495 ydelt = (ymax-ymin)/(
double)nbDivisiony;
499 vpPlotGraph::initScale(
vpImage<unsigned char> &I,
const double x_min,
const double x_max,
const int nbDivx,
500 const double y_min,
const double y_max,
const int nbDivy,
const bool gx,
const bool gy)
508 this->nbDivisionx = nbDivx;
509 this->nbDivisiony = nbDivy;
510 computeGraphParameters();
514 scaleInitialized =
true;
519 vpPlotGraph::initScale(
vpImage<unsigned char> &I,
const double x_min,
const double x_max,
const int nbDivx,
520 const double y_min,
const double y_max,
const int nbDivy,
521 const double z_min,
const double z_max,
const int nbDivz,
const bool gx,
const bool gy)
531 this->nbDivisionx = nbDivx;
532 this->nbDivisiony = nbDivy;
533 this->nbDivisionz = nbDivz;
534 computeGraphParameters();
538 scaleInitialized =
true;
544 if (!scaleInitialized)
566 scaleInitialized =
true;
567 computeGraphParameters();
571 if (std::fabs(y) <= std::numeric_limits<double>::epsilon())
572 scaleInitialized =
false;
584 double i = yorg-(zoomy*y);
585 double j = xorg+(zoomx*x);
591 if (x > xmax) rescalex(1,x);
592 else if(x < xmin) rescalex(0,x);
594 if (y > ymax) rescaley(1,y);
595 else if(y < ymin) rescaley(0,y);
597 computeGraphParameters();
606 (curveList+curveNb)->plotPoint(I, iP, x, y);
607 #if (!defined VISP_HAVE_X11 && defined FLUSH_ON_PLOT)
618 for (
unsigned int i = 0; i < curveNbr; i++)
619 (curveList+i)->plotList(I,xorg,yorg,zoomx,zoomy);
634 double x = (iP.
get_j()-xorg)/zoomx;
635 double y = (yorg-iP.
get_i())/zoomy;
639 sprintf(valeur,
" x: %f", x);
641 sprintf(valeur,
" y: %f", y);
651 vpPlotGraph::resetPointList(
const unsigned int curveNum)
653 (curveList+curveNum)->pointListx.clear();
654 (curveList+curveNum)->pointListy.clear();
655 (curveList+curveNum)->pointListz.clear();
656 (curveList+curveNum)->nbPoint = 0;
669 if (!iP1In || !iP2In)
671 double dTopLeft_i = dTopLeft3D.get_i();
672 double dTopLeft_j = dTopLeft3D.get_j();
673 double dBottomRight_i = dTopLeft_i+dHeight;
674 double dBottomRight_j = dTopLeft_j+dWidth;
681 if (!iP1In && !iP2In)
683 if (iP1.
get_i() < dTopLeft_i && iP2.
get_i() < dTopLeft_i)
685 if (iP1.
get_i() > dBottomRight_i && iP2.
get_i() > dBottomRight_i)
687 if (iP1.
get_j() < dTopLeft_j || iP1.
get_j() > dBottomRight_j)
689 if (iP1.
get_i() < dTopLeft_i) iP1.
set_i(dTopLeft_i);
690 else iP1.
set_i(dBottomRight_i);
691 if (iP2.
get_i() < dTopLeft_i) iP2.
set_i(dTopLeft_i);
692 else iP2.
set_i(dBottomRight_i);
696 if (iP1.
get_j() < dTopLeft_j) iP1.
set_j(dTopLeft_j);
697 if (iP1.
get_j() > dBottomRight_j) iP1.
set_j(dBottomRight_j);
698 if (iP1.
get_i() < dTopLeft_i) iP1.
set_i(dTopLeft_i);
699 if (iP1.
get_i() > dBottomRight_i) iP1.
set_i(dBottomRight_i);
704 if (iP2.
get_j() < dTopLeft_j) iP2.
set_j(dTopLeft_j);
705 if (iP2.
get_j() > dBottomRight_j) iP2.
set_j(dBottomRight_j);
706 if (iP2.
get_i() < dTopLeft_i) iP2.
set_i(dTopLeft_i);
707 if (iP2.
get_i() > dBottomRight_i) iP2.
set_i(dBottomRight_i);
714 if (!iP1In && !iP2In)
716 if (iP1.
get_j() < dTopLeft_j && iP2.
get_j() < dTopLeft_j)
718 if (iP1.
get_j() > dBottomRight_j && iP2.
get_j() > dBottomRight_j)
720 if (iP1.
get_i() < dTopLeft_i || iP1.
get_i() > dBottomRight_i)
722 if (iP1.
get_j() < dTopLeft_j) iP1.
set_j(dTopLeft_j);
723 else iP1.
set_j(dBottomRight_j);
724 if (iP2.
get_j() < dTopLeft_j) iP2.
set_j(dTopLeft_j);
725 else iP2.
set_j(dBottomRight_j);
729 if (iP1.
get_j() < dTopLeft_j) iP1.
set_j(dTopLeft_j);
730 if (iP1.
get_j() > dBottomRight_j) iP1.
set_j(dBottomRight_j);
731 if (iP1.
get_i() < dTopLeft_i) iP1.
set_i(dTopLeft_i);
732 if (iP1.
get_i() > dBottomRight_i) iP1.
set_i(dBottomRight_i);
737 if (iP2.
get_j() < dTopLeft_j) iP2.
set_j(dTopLeft_j);
738 if (iP2.
get_j() > dBottomRight_j) iP2.
set_j(dBottomRight_j);
739 if (iP2.
get_i() < dTopLeft_i) iP2.
set_i(dTopLeft_i);
740 if (iP2.
get_i() > dBottomRight_i) iP2.
set_i(dBottomRight_i);
749 double jtop = (dTopLeft_i-b)/a;
750 double jlow = (dBottomRight_i-b)/a;
752 double ileft = dTopLeft_j*a+b;
753 double iright = (dBottomRight_j)*a+b;
758 if(jtop >= dTopLeft_j && jtop <= dBottomRight_j)
760 iP[n].
set_ij(dTopLeft_i,jtop);
763 if(jlow >= dTopLeft_j && jlow <= dBottomRight_j)
765 iP[n].
set_ij(dBottomRight_i,jlow);
768 if(ileft >= dTopLeft_i && ileft <= dBottomRight_i && n <2)
770 iP[n].
set_ij(ileft,dTopLeft_j);
773 if(iright >= dTopLeft_i && iright <= dBottomRight_i && n <2)
775 iP[n].
set_ij(iright,dBottomRight_j);
782 if (!iP1In && !iP2In)
791 iP1 = iP[0]; iP2 = iP[1];
795 iP1 = iP[1]; iP2 = iP[0];
805 iP1 = iP[0];iP2 = iP[1];
809 iP1 = iP[1];iP2 = iP[0];
819 if (fabs(iP[0].get_j()-iP2.
get_j()) > 5)
833 if (fabs(iP[0].get_i()-iP2.
get_i()) > 5)
856 if (fabs(iP[0].get_j()-iP1.
get_j()) > 5)
870 if (fabs(iP[0].get_i()-iP1.
get_i()) > 5)
896 if (iP.
get_i() < dTopLeft3D.get_i())
897 iP.
set_i(dTopLeft3D.get_i());
898 else if (iP.
get_i() > dTopLeft3D.get_i()+dHeight)
899 iP.
set_i(dTopLeft3D.get_i()+dHeight-1);
900 if (iP.
get_j() <dTopLeft3D.get_j())
901 iP.
set_j(dTopLeft3D.get_j());
902 else if (iP.
get_j() > dTopLeft3D.get_j()+dWidth)
903 iP.
set_j(dTopLeft3D.get_j()+dWidth-1);
910 vpPlotGraph::computeGraphParameters3D()
912 zoomx_3D = w_xsize/(xmax-xmin);
913 zoomy_3D = w_ysize/(ymax-ymin);
914 zoomz_3D = w_zsize/(zmax-zmin);
915 ptXorg = w_xval - zoomx_3D*xmax;
916 ptYorg = w_yval + zoomy_3D*ymin;
917 ptZorg = w_zval - zoomz_3D*zmax;
939 computeGraphParameters3D();
941 xdelt = (xmax-xmin)/nbDivisionx;
942 ydelt = (ymax-ymin)/nbDivisiony;
943 zdelt = (zmax-zmin)/nbDivisionz;
954 for (
unsigned int i = 0; i < 6; i++)
960 iP[i] = iP[i] + dTopLeft3D;
974 power = laFonctionSansNom(xdelt);
977 if (std::fabs(iP[0].get_j()-iP[1].get_j()) >
978 vpMath::maximum(std::fabs(iP[0].get_j()), std::fabs(iP[1].get_j()))* std::numeric_limits<double>::epsilon())
979 pente = fabs((iP[0].get_i()-iP[1].get_i())/(iP[0].get_j()-iP[1].get_j()));
982 unsigned int count = 1;
983 for(t=xmin;t<=xmax;t=t+xdelt)
985 double x = ptXorg+(zoomx_3D*t);
991 iPunit = iPunit + dTopLeft3D;
993 getGrid3DPoint(pente,iPunit,ip1,ip2,ip3);
995 if(check3Dline(ip1,ip2))
1002 ttemp = t*pow(10.0,power);
1004 sprintf(valeur,
"%.1f", ttemp);
1013 sprintf(valeur,
"x10e%d", -power);
1014 if(check3Dpoint(ip4))
1018 power = laFonctionSansNom(ydelt);
1021 if (std::fabs(iP[2].get_j()-iP[3].get_j()) >
1022 vpMath::maximum(std::fabs(iP[2].get_j()), std::fabs(iP[3].get_j()))* std::numeric_limits<double>::epsilon())
1023 pente = fabs((iP[2].get_i()-iP[3].get_i())/(iP[2].get_j()-iP[3].get_j()));
1026 for(t=ymin;t<=ymax;t=t+ydelt)
1028 double y = ptYorg-(zoomy_3D*t);
1031 double u=0.0, v=0.0;
1034 iPunit = iPunit + dTopLeft3D;
1036 getGrid3DPoint(pente,iPunit,ip1,ip2,ip3);
1038 if(check3Dline(ip1,ip2))
1045 ttemp = t*pow(10.0,power);
1047 sprintf(valeur,
"%.1f", ttemp);
1056 sprintf(valeur,
"x10e%d", -power);
1057 if(check3Dpoint(ip4))
1061 power = laFonctionSansNom(zdelt);
1064 if (std::fabs(iP[4].get_j()-iP[5].get_j()) >
1065 vpMath::maximum(std::fabs(iP[4].get_j()), std::fabs(iP[5].get_j()))* std::numeric_limits<double>::epsilon())
1066 pente = fabs((iP[4].get_i()-iP[5].get_i())/(iP[4].get_j()-iP[5].get_j()));
1069 for(t=zmin;t<=zmax;t=t+zdelt)
1071 double z = ptZorg+(zoomz_3D*t);
1074 double u=0.0, v=0.0;
1077 iPunit = iPunit + dTopLeft3D;
1079 getGrid3DPoint(pente,iPunit,ip1,ip2,ip3);
1081 if(check3Dline(ip1,ip2))
1088 ttemp = t*pow(10.0,power);
1090 sprintf(valeur,
"%.1f", ttemp);
1099 sprintf(valeur,
"x10e%d", -power);
1100 if(check3Dpoint(ip4))
1106 if (check3Dline(iP[0],iP[1]))
1111 iPunit.
set_ij(iP[1].get_i(),iP[1].get_j()-10*epsj);
1112 check3Dpoint (iPunit);
1116 if (check3Dline(iP[3],iP[2]))
1121 iPunit.
set_ij(iP[2].get_i(),iP[2].get_j()-10*epsj);
1122 check3Dpoint (iPunit);
1126 if (check3Dline(iP[4],iP[5]))
1131 iPunit.
set_ij(iP[5].get_i(),iP[5].get_j()-10*epsj);
1132 check3Dpoint (iPunit);
1144 vpPlotGraph::plot (
vpImage<unsigned char> &I,
const unsigned int curveNb,
const double x,
const double y,
const double z)
1146 if (!scaleInitialized)
1178 scaleInitialized =
true;
1179 computeGraphParameters3D();
1183 if (std::fabs(y) <= std::numeric_limits<double>::epsilon() || std::fabs(z) <= std::numeric_limits<double>::epsilon())
1184 scaleInitialized =
false;
1195 bool changed =
false;
1196 if (x > xmax) {rescalex(1,x); changed =
true;}
1197 else if(x < xmin) {rescalex(0,x);changed =
true;}
1199 if (y > ymax) {rescaley(1,y);changed =
true;}
1200 else if(y < ymin) {rescaley(0,y);changed =
true;}
1202 if (z > zmax) {rescalez(1,z);changed =
true;}
1203 else if(z < zmin) {rescalez(0,z);changed =
true;}
1207 if (changed || move(I, button))
1209 computeGraphParameters3D();
1214 pointPlot.
setWorldCoordinates(ptXorg+(zoomx_3D*x),ptYorg-(zoomy_3D*y),ptZorg+(zoomz_3D*z));
1215 pointPlot.
track(cMo);
1216 double u=0.0, v=0.0;
1220 iP = iP + dTopLeft3D;
1222 (curveList+curveNb)->pointListx.end();
1223 (curveList+curveNb)->pointListy.end();
1224 (curveList+curveNb)->pointListz.end();
1225 if((curveList+curveNb)->nbPoint)
1227 if (check3Dline((curveList+curveNb)->lastPoint,iP))
1228 vpDisplay::displayLine(I,(curveList+curveNb)->lastPoint, iP, (curveList+curveNb)->color, (curveList+curveNb)->thickness);
1230 #if( defined VISP_HAVE_X11 || defined VISP_HAVE_GDI )
1236 if (iP.get_i() <= (curveList+curveNb)->lastPoint.get_i()) {top = iP.get_i()-5; height_ = (curveList+curveNb)->lastPoint.get_i() - top+10;}
1237 else {top = (curveList+curveNb)->lastPoint.get_i()-5; height_ = iP.get_i() - top+10;}
1238 if (iP.get_j() <= (curveList+curveNb)->lastPoint.get_j()) {left = iP.get_j()-5; width_ = (curveList+curveNb)->lastPoint.get_j() - left+10;}
1239 else {left = (curveList+curveNb)->lastPoint.get_j()-5; width_ = iP.get_j() - left+10;}
1243 (curveList+curveNb)->lastPoint = iP;
1244 (curveList+curveNb)->pointListx.push_back(x);
1245 (curveList+curveNb)->pointListy.push_back(y);
1246 (curveList+curveNb)->pointListz.push_back(z);
1247 (curveList+curveNb)->nbPoint++;
1249 #if( !defined VISP_HAVE_X11 && defined FLUSH_ON_PLOT)
1261 for (
unsigned int i = 0; i < curveNbr; i++)
1263 std::list<double>::const_iterator it_ptListx = (curveList+i)->pointListx.begin();
1264 std::list<double>::const_iterator it_ptListy = (curveList+i)->pointListy.begin();
1265 std::list<double>::const_iterator it_ptListz = (curveList+i)->pointListz.begin();
1271 while (k < (curveList+i)->nbPoint)
1276 pointPlot.
setWorldCoordinates(ptXorg+(zoomx_3D*x),ptYorg-(zoomy_3D*y),ptZorg+(zoomz_3D*z));
1277 pointPlot.
track(cMo);
1278 double u=0.0, v=0.0;
1281 iP = iP + dTopLeft3D;
1286 if (check3Dline((curveList+i)->lastPoint,iP))
1291 (curveList+i)->lastPoint = iP;
1305 vpPlotGraph::rescalez(
unsigned int side,
double extremity)
1310 zmin = (3*extremity-zmax)/2;
1313 zmax = (3*extremity-zmin)/2;
1317 zdelt = (zmax-zmin)/(
double)nbDivisionz;
1327 bool changed =
false;
1331 if (std::fabs(displacement[2][3]) > std::numeric_limits<double>::epsilon())
1332 cMf = cMf*displacement;
1335 cMo = cMf* displacement * fMo;
1344 bool clicked =
false;
1345 bool clickedUp =
false;
1381 if (!(blockedr || blockedz))
1397 double diffi = iP.
get_i() - old_iPr.get_i();
1398 double diffj = iP.
get_j() - old_iPr.get_j();
1400 anglei = diffi*360/width_;
1401 anglej = diffj*360/width_;
1406 if (blockedr) old_iPr = iP;
1410 double diffi = iP.
get_i() - old_iPz.get_i();
1411 mov.buildFrom(0,0,diffi*0.01,0,0,0);
1415 if (blockedz) old_iPz = iP;
1420 #elif !defined(VISP_BUILD_SHARED_LIBS)
1422 void dummy_vpPlotGraph() {};
void set_oZ(const double oZ)
Set the point Z coordinate in the object frame.
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
Implementation of an homogeneous matrix and operations on such kind of matrices.
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
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
virtual bool getPointerPosition(vpImagePoint &ip)=0
bool computePose(vpPoseMethodType methode, vpHomogeneousMatrix &cMo, bool(*func)(vpHomogeneousMatrix *)=NULL)
compute the pose for a given method
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.
void set_oX(const double oX)
Set the point X coordinate in the object frame.
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)
void setWorldCoordinates(const double oX, const double oY, const double oZ)
void set_oY(const double oY)
Set the point Y coordinate in the object frame.
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)
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 clearPoint()
suppress all the point in the array of point