40 #include <visp3/core/vpConfig.h> 41 #ifndef DOXYGEN_SHOULD_SKIP_THIS 43 #include <visp3/core/vpMath.h> 44 #include <visp3/core/vpMeterPixelConversion.h> 45 #include <visp3/core/vpPixelMeterConversion.h> 46 #include <visp3/gui/vpPlotGraph.h> 49 #include <visp3/gui/vpDisplayD3D.h> 50 #include <visp3/gui/vpDisplayGDI.h> 51 #include <visp3/gui/vpDisplayGTK.h> 52 #include <visp3/gui/vpDisplayOpenCV.h> 53 #include <visp3/gui/vpDisplayX.h> 57 #include <visp3/core/vpMath.h> 59 #if defined(VISP_HAVE_DISPLAY) 61 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), xdelt(1), ydelt(1), gridx(true),
66 gridy(true), gridColor(), curveNbr(1), curveList(NULL), scaleInitialized(false), firstPoint(true), nbDivisionx(10),
67 nbDivisiony(10), topLeft(), width(0), height(0), graphZone(), dTopLeft(), dWidth(0), dHeight(0), dGraphZone(),
68 dTopLeft3D(), dGraphZone3D(), cam(), cMo(), cMf(), w_xval(0), w_xsize(0), w_yval(0), w_ysize(0), w_zval(0),
69 w_zsize(0), ptXorg(0), ptYorg(0), ptZorg(0), zoomx_3D(1.), zoomy_3D(1.), zoomz_3D(1.), nbDivisionz(10), zorg(1.),
70 zoomz(1.), zmax(10), zmin(-10), zdelt(1), old_iPr(), old_iPz(), blockedr(false), blockedz(false), blocked(false),
71 epsi(5), epsj(6), dispUnit(false), dispTitle(false), dispLegend(false), gridThickness(1)
73 gridColor.setColor(200, 200, 200);
81 vpPlotGraph::~vpPlotGraph()
83 if (curveList != NULL) {
89 void vpPlotGraph::initGraph(
unsigned int nbCurve)
91 curveList =
new vpPlotCurve[nbCurve];
96 for (
unsigned int i = 0; i < curveNbr; i++) {
97 (curveList + i)->color = colors[i % 6];
98 (curveList + i)->curveStyle = vpPlotCurve::line;
99 (curveList + i)->pointListx.clear();
100 (curveList + i)->pointListy.clear();
101 (curveList + i)->legend.clear();
105 void vpPlotGraph::initSize(
vpImagePoint top_left,
unsigned int w,
unsigned int h,
unsigned int margei,
108 this->topLeft = top_left;
111 graphZone.setTopLeft(topLeft);
112 graphZone.setWidth(width);
113 graphZone.setHeight(height);
115 this->dTopLeft =
vpImagePoint(topLeft.get_i() + margei, topLeft.get_j() + margej);
116 this->dWidth = width - margej - 10;
117 this->dHeight = height - 2 * margei;
118 dGraphZone.setTopLeft(dTopLeft);
119 dGraphZone.setWidth(dWidth + 1);
120 dGraphZone.setHeight(dHeight + 1);
122 this->dTopLeft3D =
vpImagePoint(topLeft.get_i() + margei, topLeft.get_j() + 10);
123 dGraphZone3D.setTopLeft(dTopLeft3D);
124 dGraphZone3D.setWidth(dWidth + 1);
125 dGraphZone3D.setHeight(dHeight + 1);
127 if (this->dWidth > this->dHeight) {
129 w_xsize = this->dWidth / this->dHeight;
132 w_yval = w_ysize / 2.0;
133 w_xval = w_xsize / 2.0;
134 w_zval = w_zsize / 2.0;
135 }
else if (this->dWidth == this->dHeight) {
143 }
else if (this->dWidth < this->dHeight) {
145 w_ysize = this->dHeight / this->dWidth;
148 w_yval = w_ysize / 2.0;
149 w_xval = w_xsize / 2.0;
150 w_zval = w_zsize / 2.0;
157 cMf.buildFrom(0, 0, cMo[2][3], 0, 0, 0);
160 void vpPlotGraph::findPose()
170 iP[1].
set_ij(0, dWidth - 1);
171 iP[2].
set_ij(dHeight - 1, dWidth - 1);
172 iP[3].
set_ij(dHeight - 1, 0);
180 for (
unsigned int i=0 ; i < 4 ; i++)
194 for (
unsigned int i = 0; i < 4; i++) {
203 void vpPlotGraph::computeGraphParameters()
205 zoomx = dWidth / (xmax - xmin);
206 zoomy = dHeight / (ymax - ymin);
207 xorg = dTopLeft.
get_j() - (xmin * zoomx);
208 yorg = dTopLeft.get_i() + (ymax * zoomy);
211 void vpPlotGraph::setCurveColor(
const unsigned int curveNum,
const vpColor &color)
213 (curveList + curveNum)->color = color;
216 void vpPlotGraph::setTitle(
const std::string &title_)
222 void vpPlotGraph::setUnitX(
const std::string &unit_x)
228 void vpPlotGraph::setUnitY(
const std::string &unit_y)
234 void vpPlotGraph::setUnitZ(
const std::string &unit_z)
240 void vpPlotGraph::setLegend(
const unsigned int curveNum,
const std::string &newlegend)
242 (curveList + curveNum)->legend = newlegend;
246 void vpPlotGraph::setCurveThickness(
const unsigned int curveNum,
const unsigned int thickness)
248 (curveList + curveNum)->thickness = thickness;
251 int laFonctionSansNom(
const double delta)
278 computeGraphParameters();
280 xdelt = (xmax - xmin) / nbDivisionx;
281 ydelt = (ymax - ymin) / nbDivisiony;
287 power = laFonctionSansNom(xdelt);
288 for (t = xmin; t <= xmax; t = t + xdelt) {
289 double x = xorg + (zoomx * t);
292 gridColor, gridThickness);
296 if (t + xdelt <= xmax + 1e-10) {
299 ttemp = t * pow(10.0, power);
302 sprintf(valeur,
"%.2f", ttemp);
303 #if defined VISP_HAVE_X11 305 #elif defined(VISP_HAVE_GDI) || defined(VISP_HAVE_OPENCV) || defined(VISP_HAVE_D3D9) || defined(VISP_HAVE_GTK) 311 sprintf(valeur,
"x10e%d", -power);
312 #if defined VISP_HAVE_X11 315 #elif defined(VISP_HAVE_GDI) || defined(VISP_HAVE_OPENCV) || defined(VISP_HAVE_D3D9) || defined(VISP_HAVE_GTK) 321 power = laFonctionSansNom(ydelt);
322 for (t = ymin; t <= ymax; t = t + ydelt) {
323 double y = yorg - (zoomy * t);
326 gridColor, gridThickness);
332 ttemp = t * pow(10.0, power);
336 sprintf(valeur,
"%.2f", ttemp);
337 #if defined VISP_HAVE_X11 339 #elif defined(VISP_HAVE_GDI) || defined(VISP_HAVE_OPENCV) || defined(VISP_HAVE_D3D9) || defined(VISP_HAVE_GTK) 344 sprintf(valeur,
"x10e%d", -power);
345 #if defined VISP_HAVE_X11 348 #elif defined(VISP_HAVE_GDI) || defined(VISP_HAVE_OPENCV) || defined(VISP_HAVE_D3D9) || defined(VISP_HAVE_GTK) 356 vpColor::black, 4 * gridThickness, 2 * gridThickness, gridThickness);
359 vpColor::black, 4 * gridThickness, 2 * gridThickness, gridThickness);
372 #
if defined(VISP_HAVE_X11) || defined(VISP_HAVE_GDI) || defined(VISP_HAVE_OPENCV) || defined(VISP_HAVE_D3D9) || \
373 defined(VISP_HAVE_GTK)
378 unsigned int offsetx = vpMath::minimum<unsigned int>((
unsigned int)unitx.size(), dWidth);
380 #if defined VISP_HAVE_X11 384 #elif defined(VISP_HAVE_GDI) || defined(VISP_HAVE_OPENCV) || defined(VISP_HAVE_D3D9) || defined(VISP_HAVE_GTK) 393 double size = (double)title.size();
402 for (
unsigned int i = 0; i < curveNbr; i++) {
403 size_t offset = epsj * (curveList + i)->legend.size();
406 if (offsetj > dWidth)
409 for (
unsigned int i = 0; i < curveNbr; i++) {
411 (curveList + i)->legend.c_str(), (curveList + i)->color);
415 void vpPlotGraph::rescalex(
unsigned int side,
double extremity)
419 xmin = (3 * extremity - xmax) / 2;
422 xmax = (3 * extremity - xmin) / 2;
426 xdelt = (xmax - xmin) / (
double)nbDivisionx;
429 void vpPlotGraph::rescaley(
unsigned int side,
double extremity)
433 ymin = (3 * extremity - ymax) / 2;
436 ymax = (3 * extremity - ymin) / 2;
440 ydelt = (ymax - ymin) / (
double)nbDivisiony;
443 void vpPlotGraph::initScale(
vpImage<unsigned char> &I,
const double x_min,
const double x_max,
const int nbDivx,
444 const double y_min,
const double y_max,
const int nbDivy,
const bool gx,
const bool gy)
452 this->nbDivisionx = nbDivx;
453 this->nbDivisiony = nbDivy;
454 computeGraphParameters();
458 scaleInitialized =
true;
461 void vpPlotGraph::initScale(
vpImage<unsigned char> &I,
const double x_min,
const double x_max,
const int nbDivx,
462 const double y_min,
const double y_max,
const int nbDivy,
const double z_min,
463 const double z_max,
const int nbDivz,
const bool gx,
const bool gy)
473 this->nbDivisionx = nbDivx;
474 this->nbDivisiony = nbDivy;
475 this->nbDivisionz = nbDivz;
476 computeGraphParameters();
480 scaleInitialized =
true;
483 void vpPlotGraph::plot(
vpImage<unsigned char> &I,
const unsigned int curveNb,
const double x,
const double y)
485 if (!scaleInitialized) {
502 scaleInitialized =
true;
503 computeGraphParameters();
507 if (std::fabs(y) <= std::numeric_limits<double>::epsilon())
508 scaleInitialized =
false;
519 double i = yorg - (zoomy * y);
520 double j = xorg + (zoomx * x);
535 computeGraphParameters();
538 i = yorg - (zoomy * y);
539 j = xorg + (zoomx * x);
544 (curveList + curveNb)->plotPoint(I, iP, x, y);
545 #if (!defined VISP_HAVE_X11 && defined FLUSH_ON_PLOT) 555 for (
unsigned int i = 0; i < curveNbr; i++)
556 (curveList + i)->plotList(I, xorg, yorg, zoomx, zoomy);
565 double x = (iP.
get_j() - xorg) / zoomx;
566 double y = (yorg - iP.
get_i()) / zoomy;
570 sprintf(valeur,
" x: %f", x);
573 sprintf(valeur,
" y: %f", y);
583 void vpPlotGraph::resetPointList(
const unsigned int curveNum)
585 (curveList + curveNum)->pointListx.clear();
586 (curveList + curveNum)->pointListy.clear();
587 (curveList + curveNum)->pointListz.clear();
588 (curveList + curveNum)->nbPoint = 0;
599 if (!iP1In || !iP2In) {
600 double dTopLeft_i = dTopLeft3D.get_i();
601 double dTopLeft_j = dTopLeft3D.get_j();
602 double dBottomRight_i = dTopLeft_i + dHeight;
603 double dBottomRight_j = dTopLeft_j + dWidth;
609 if (!iP1In && !iP2In) {
610 if (iP1.
get_i() < dTopLeft_i && iP2.
get_i() < dTopLeft_i)
612 if (iP1.
get_i() > dBottomRight_i && iP2.
get_i() > dBottomRight_i)
614 if (iP1.
get_j() < dTopLeft_j || iP1.
get_j() > dBottomRight_j)
616 if (iP1.
get_i() < dTopLeft_i)
617 iP1.
set_i(dTopLeft_i);
619 iP1.
set_i(dBottomRight_i);
620 if (iP2.
get_i() < dTopLeft_i)
621 iP2.
set_i(dTopLeft_i);
623 iP2.
set_i(dBottomRight_i);
625 if (iP1.
get_j() < dTopLeft_j)
626 iP1.
set_j(dTopLeft_j);
627 if (iP1.
get_j() > dBottomRight_j)
628 iP1.
set_j(dBottomRight_j);
629 if (iP1.
get_i() < dTopLeft_i)
630 iP1.
set_i(dTopLeft_i);
631 if (iP1.
get_i() > dBottomRight_i)
632 iP1.
set_i(dBottomRight_i);
635 if (iP2.
get_j() < dTopLeft_j)
636 iP2.
set_j(dTopLeft_j);
637 if (iP2.
get_j() > dBottomRight_j)
638 iP2.
set_j(dBottomRight_j);
639 if (iP2.
get_i() < dTopLeft_i)
640 iP2.
set_i(dTopLeft_i);
641 if (iP2.
get_i() > dBottomRight_i)
642 iP2.
set_i(dBottomRight_i);
647 else if (fabs(iP2.
get_i() - iP1.
get_i()) <= 2) {
648 if (!iP1In && !iP2In) {
649 if (iP1.
get_j() < dTopLeft_j && iP2.
get_j() < dTopLeft_j)
651 if (iP1.
get_j() > dBottomRight_j && iP2.
get_j() > dBottomRight_j)
653 if (iP1.
get_i() < dTopLeft_i || iP1.
get_i() > dBottomRight_i)
655 if (iP1.
get_j() < dTopLeft_j)
656 iP1.
set_j(dTopLeft_j);
658 iP1.
set_j(dBottomRight_j);
659 if (iP2.
get_j() < dTopLeft_j)
660 iP2.
set_j(dTopLeft_j);
662 iP2.
set_j(dBottomRight_j);
664 if (iP1.
get_j() < dTopLeft_j)
665 iP1.
set_j(dTopLeft_j);
666 if (iP1.
get_j() > dBottomRight_j)
667 iP1.
set_j(dBottomRight_j);
668 if (iP1.
get_i() < dTopLeft_i)
669 iP1.
set_i(dTopLeft_i);
670 if (iP1.
get_i() > dBottomRight_i)
671 iP1.
set_i(dBottomRight_i);
674 if (iP2.
get_j() < dTopLeft_j)
675 iP2.
set_j(dTopLeft_j);
676 if (iP2.
get_j() > dBottomRight_j)
677 iP2.
set_j(dBottomRight_j);
678 if (iP2.
get_i() < dTopLeft_i)
679 iP2.
set_i(dTopLeft_i);
680 if (iP2.
get_i() > dBottomRight_i)
681 iP2.
set_i(dBottomRight_i);
690 double jtop = (dTopLeft_i - b) / a;
691 double jlow = (dBottomRight_i - b) / a;
693 double ileft = dTopLeft_j * a + b;
694 double iright = (dBottomRight_j)*a + b;
699 if (jtop >= dTopLeft_j && jtop <= dBottomRight_j) {
700 iP[n].
set_ij(dTopLeft_i, jtop);
703 if (jlow >= dTopLeft_j && jlow <= dBottomRight_j) {
704 iP[n].
set_ij(dBottomRight_i, jlow);
707 if (ileft >= dTopLeft_i && ileft <= dBottomRight_i && n < 2) {
708 iP[n].
set_ij(ileft, dTopLeft_j);
711 if (iright >= dTopLeft_i && iright <= dBottomRight_i && n < 2) {
712 iP[n].
set_ij(iright, dBottomRight_j);
719 if (!iP1In && !iP2In) {
724 if (sign ==
vpMath::sign(iP[0].get_j() - iP[1].get_j())) {
735 if (sign ==
vpMath::sign(iP[0].get_i() - iP[1].get_i())) {
747 if (fabs(iP[0].get_j() - iP2.
get_j()) > 5) {
760 if (fabs(iP[0].get_i() - iP2.
get_i()) > 5) {
780 if (fabs(iP[0].get_j() - iP1.
get_j()) > 5) {
793 if (fabs(iP[0].get_i() - iP1.
get_i()) > 5) {
817 if (iP.
get_i() < dTopLeft3D.get_i())
818 iP.
set_i(dTopLeft3D.get_i());
819 else if (iP.
get_i() > dTopLeft3D.get_i() + dHeight)
820 iP.
set_i(dTopLeft3D.get_i() + dHeight - 1);
821 if (iP.
get_j() < dTopLeft3D.get_j())
822 iP.
set_j(dTopLeft3D.get_j());
823 else if (iP.
get_j() > dTopLeft3D.get_j() + dWidth)
824 iP.
set_j(dTopLeft3D.get_j() + dWidth - 1);
830 void vpPlotGraph::computeGraphParameters3D()
832 zoomx_3D = w_xsize / (xmax - xmin);
833 zoomy_3D = w_ysize / (ymax - ymin);
834 zoomz_3D = w_zsize / (zmax - zmin);
835 ptXorg = w_xval - zoomx_3D * xmax;
836 ptYorg = w_yval + zoomy_3D * ymin;
837 ptZorg = w_zval - zoomz_3D * zmax;
855 computeGraphParameters3D();
857 xdelt = (xmax - xmin) / nbDivisionx;
858 ydelt = (ymax - ymin) / nbDivisiony;
859 zdelt = (zmax - zmin) / nbDivisionz;
870 for (
unsigned int i = 0; i < 6; i++) {
872 double u = 0.0, v = 0.0;
875 iP[i] = iP[i] + dTopLeft3D;
889 power = laFonctionSansNom(xdelt);
892 if (std::fabs(iP[0].get_j() - iP[1].get_j()) >
893 vpMath::maximum(std::fabs(iP[0].get_j()), std::fabs(iP[1].get_j())) * std::numeric_limits<double>::epsilon())
894 pente = fabs((iP[0].get_i() - iP[1].get_i()) / (iP[0].get_j() - iP[1].get_j()));
898 unsigned int count = 1;
899 for (t = xmin; t <= xmax; t = t + xdelt) {
900 double x = ptXorg + (zoomx_3D * t);
903 double u = 0.0, v = 0.0;
906 iPunit = iPunit + dTopLeft3D;
908 getGrid3DPoint(pente, iPunit, ip1, ip2, ip3);
910 if (check3Dline(ip1, ip2)) {
912 if (count % 2 == 1) {
915 ttemp = t * pow(10.0, power);
918 sprintf(valeur,
"%.1f", ttemp);
926 sprintf(valeur,
"x10e%d", -power);
927 if (check3Dpoint(ip4))
931 power = laFonctionSansNom(ydelt);
934 if (std::fabs(iP[2].get_j() - iP[3].get_j()) >
935 vpMath::maximum(std::fabs(iP[2].get_j()), std::fabs(iP[3].get_j())) * std::numeric_limits<double>::epsilon())
936 pente = fabs((iP[2].get_i() - iP[3].get_i()) / (iP[2].get_j() - iP[3].get_j()));
940 for (t = ymin; t <= ymax; t = t + ydelt) {
941 double y = ptYorg - (zoomy_3D * t);
944 double u = 0.0, v = 0.0;
947 iPunit = iPunit + dTopLeft3D;
949 getGrid3DPoint(pente, iPunit, ip1, ip2, ip3);
951 if (check3Dline(ip1, ip2)) {
953 if (count % 2 == 1) {
956 ttemp = t * pow(10.0, power);
959 sprintf(valeur,
"%.1f", ttemp);
967 sprintf(valeur,
"x10e%d", -power);
968 if (check3Dpoint(ip4))
972 power = laFonctionSansNom(zdelt);
975 if (std::fabs(iP[4].get_j() - iP[5].get_j()) >
976 vpMath::maximum(std::fabs(iP[4].get_j()), std::fabs(iP[5].get_j())) * std::numeric_limits<double>::epsilon())
977 pente = fabs((iP[4].get_i() - iP[5].get_i()) / (iP[4].get_j() - iP[5].get_j()));
981 for (t = zmin; t <= zmax; t = t + zdelt) {
982 double z = ptZorg + (zoomz_3D * t);
985 double u = 0.0, v = 0.0;
988 iPunit = iPunit + dTopLeft3D;
990 getGrid3DPoint(pente, iPunit, ip1, ip2, ip3);
992 if (check3Dline(ip1, ip2)) {
994 if (count % 2 == 1) {
997 ttemp = t * pow(10.0, power);
1000 sprintf(valeur,
"%.1f", ttemp);
1008 sprintf(valeur,
"x10e%d", -power);
1009 if (check3Dpoint(ip4))
1014 if (check3Dline(iP[0], iP[1])) {
1017 iPunit.
set_ij(iP[1].get_i(), iP[1].get_j() - 10 * epsj);
1018 check3Dpoint(iPunit);
1022 if (check3Dline(iP[3], iP[2])) {
1025 iPunit.
set_ij(iP[2].get_i(), iP[2].get_j() - 10 * epsj);
1026 check3Dpoint(iPunit);
1030 if (check3Dline(iP[4], iP[5])) {
1033 iPunit.
set_ij(iP[5].get_i(), iP[5].get_j() - 10 * epsj);
1034 check3Dpoint(iPunit);
1046 const double x,
const double y,
const double z)
1048 if (!scaleInitialized) {
1073 scaleInitialized =
true;
1074 computeGraphParameters3D();
1078 if (std::fabs(y) <= std::numeric_limits<double>::epsilon() ||
1079 std::fabs(z) <= std::numeric_limits<double>::epsilon())
1080 scaleInitialized =
false;
1090 bool changed =
false;
1094 }
else if (x < xmin) {
1102 }
else if (y < ymin) {
1110 }
else if (z < zmin) {
1117 if (changed || move(I, button)) {
1118 computeGraphParameters3D();
1123 pointPlot.
setWorldCoordinates(ptXorg + (zoomx_3D * x), ptYorg - (zoomy_3D * y), ptZorg + (zoomz_3D * z));
1124 pointPlot.
track(cMo);
1125 double u = 0.0, v = 0.0;
1129 iP = iP + dTopLeft3D;
1131 if ((curveList + curveNb)->nbPoint) {
1132 if (check3Dline((curveList + curveNb)->lastPoint, iP))
1134 (curveList + curveNb)->thickness);
1136 #if (defined VISP_HAVE_X11 || defined VISP_HAVE_GDI) 1142 if (iP.get_i() <= (curveList + curveNb)->lastPoint.get_i()) {
1143 top = iP.get_i() - 5;
1144 height_ = (curveList + curveNb)->lastPoint.get_i() - top + 10;
1146 top = (curveList + curveNb)->lastPoint.get_i() - 5;
1147 height_ = iP.get_i() - top + 10;
1149 if (iP.get_j() <= (curveList + curveNb)->lastPoint.get_j()) {
1150 left = iP.get_j() - 5;
1151 width_ = (curveList + curveNb)->lastPoint.get_j() - left + 10;
1153 left = (curveList + curveNb)->lastPoint.get_j() - 5;
1154 width_ = iP.get_j() - left + 10;
1159 (curveList + curveNb)->lastPoint = iP;
1160 (curveList + curveNb)->pointListx.push_back(x);
1161 (curveList + curveNb)->pointListy.push_back(y);
1162 (curveList + curveNb)->pointListz.push_back(z);
1163 (curveList + curveNb)->nbPoint++;
1165 #if (!defined VISP_HAVE_X11 && defined FLUSH_ON_PLOT) 1176 for (
unsigned int i = 0; i < curveNbr; i++) {
1177 std::list<double>::const_iterator it_ptListx = (curveList + i)->pointListx.begin();
1178 std::list<double>::const_iterator it_ptListy = (curveList + i)->pointListy.begin();
1179 std::list<double>::const_iterator it_ptListz = (curveList + i)->pointListz.begin();
1184 while (k < (curveList + i)->nbPoint) {
1185 double x = *it_ptListx;
1186 double y = *it_ptListy;
1187 double z = *it_ptListz;
1188 pointPlot.
setWorldCoordinates(ptXorg + (zoomx_3D * x), ptYorg - (zoomy_3D * y), ptZorg + (zoomz_3D * z));
1189 pointPlot.
track(cMo);
1190 double u = 0.0, v = 0.0;
1193 iP = iP + dTopLeft3D;
1197 if (check3Dline((curveList + i)->lastPoint, iP))
1202 (curveList + i)->lastPoint = iP;
1213 void vpPlotGraph::rescalez(
unsigned int side,
double extremity)
1217 zmin = (3 * extremity - zmax) / 2;
1220 zmax = (3 * extremity - zmin) / 2;
1224 zdelt = (zmax - zmin) / (
double)nbDivisionz;
1233 bool changed =
false;
1237 if (std::fabs(displacement[2][3]) > std::numeric_limits<double>::epsilon())
1238 cMf = cMf * displacement;
1241 cMo = cMf * displacement * fMo;
1250 bool clicked =
false;
1251 bool clickedUp =
false;
1277 else if (clickedUp) {
1286 if (!(blockedr || blockedz)) {
1298 double diffi = iP.
get_i() - old_iPr.get_i();
1299 double diffj = iP.
get_j() - old_iPr.get_j();
1301 double anglei = diffi * 360 / width_;
1302 double anglej = diffj * 360 / width_;
1311 double diffi = iP.
get_i() - old_iPz.get_i();
1312 mov.buildFrom(0, 0, diffi * 0.01, 0, 0, 0);
1322 #elif !defined(VISP_BUILD_SHARED_LIBS) 1325 void dummy_vpPlotGraph(){};
bool computePose(vpPoseMethodType method, vpHomogeneousMatrix &cMo, bool(*func)(const vpHomogeneousMatrix &)=NULL)
void set_oZ(const double oZ)
Set the point Z coordinate in the object frame.
bool inRectangle(const vpRect &rect) const
static bool getPointerPosition(const vpImage< unsigned char > &I, vpImagePoint &ip)
static bool getClick(const vpImage< unsigned char > &I, bool blocking=true)
vpImage< unsigned char > I
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)
Class to define colors available for display functionnalities.
static void displayText(const vpImage< unsigned char > &I, const vpImagePoint &ip, const std::string &s, const vpColor &color)
static bool getClickUp(const vpImage< unsigned char > &I, vpImagePoint &ip, vpMouseButton::vpMouseButtonType &button, bool blocking=true)
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)
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
static void displayArrow(const vpImage< unsigned char > &I, const vpImagePoint &ip1, const vpImagePoint &ip2, const vpColor &color=vpColor::white, unsigned int w=4, unsigned int h=2, unsigned int thickness=1)
VISP_EXPORT void sleepMs(double t)
Class used for pose computation from N points (pose from point only). Some of the algorithms implemen...
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)
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.
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)
Class that defines a 2D point in an image. This class is useful for image processing and stores only ...
static void displayLine(const vpImage< unsigned char > &I, const vpImagePoint &ip1, const vpImagePoint &ip2, const vpColor &color, unsigned int thickness=1)
static int() sign(double x)
void addPoint(const vpPoint &P)
static const vpColor purple
static void displayDotLine(const vpImage< unsigned char > &I, const vpImagePoint &ip1, const vpImagePoint &ip2, const vpColor &color, unsigned int thickness=1)
static double distance(const vpImagePoint &iP1, const vpImagePoint &iP2)
void set_ij(const double ii, const double jj)
static const vpColor blue