ViSP  2.6.2
vpPlotGraph.h
1 
2 /****************************************************************************
3  *
4  * $Id: vpPlotGraph.h 3660 2012-03-29 10:41:21Z fspindle $
5  *
6  * This file is part of the ViSP software.
7  * Copyright (C) 2005 - 2012 by INRIA. All rights reserved.
8  *
9  * This software is free software; you can redistribute it and/or
10  * modify it under the terms of the GNU General Public License
11  * ("GPL") version 2 as published by the Free Software Foundation.
12  * See the file LICENSE.txt at the root directory of this source
13  * distribution for additional information about the GNU GPL.
14  *
15  * For using ViSP with software that can not be combined with the GNU
16  * GPL, please contact INRIA about acquiring a ViSP Professional
17  * Edition License.
18  *
19  * See http://www.irisa.fr/lagadic/visp/visp.html for more information.
20  *
21  * This software was developed at:
22  * INRIA Rennes - Bretagne Atlantique
23  * Campus Universitaire de Beaulieu
24  * 35042 Rennes Cedex
25  * France
26  * http://www.irisa.fr/lagadic
27  *
28  * If you have questions regarding the use of this file, please contact
29  * INRIA at visp@inria.fr
30  *
31  * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
32  * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
33  *
34  *
35  * Description:
36  * Define a graph for the vpPlot class.
37  *
38  * Authors:
39  * Nicolas Melchior
40  *
41  *****************************************************************************/
42 
43 #ifndef DOXYGEN_SHOULD_SKIP_THIS
44 
45 #ifndef vpPlotGraph_H
46 #define vpPlotGraph_H
47 
48 #include <visp/vpColor.h>
49 #include <visp/vpImage.h>
50 
51 #include <visp/vpPlotCurve.h>
52 
53 #include <visp/vpHomogeneousMatrix.h>
54 #include <visp/vpRect.h>
55 
56 #include <visp/vpCameraParameters.h>
57 #include <visp/vpPoint.h>
58 
59 #if defined(VISP_HAVE_X11) || defined(VISP_HAVE_GDI) || defined(VISP_HAVE_OPENCV)
60 
61 class vpPlotGraph
62 {
63  public:
64  double xorg;
65  double yorg;
66  double zoomx;
67  double zoomy;
68  double xmax;
69  double ymax;
70  double xmin;
71  double ymin;
72  double xdelt;
73  double ydelt;
74  bool gridx;
75  bool gridy;
76  vpColor gridColor;
77  char title[256];
78  char unitx[256];
79  char unity[256];
80  unsigned int curveNbr;
81  vpPlotCurve* curveList;
82  bool textdispayed;
83  bool scaleInitialized;
84  bool firstPoint;
85 
86  int nbDivisionx;
87  int nbDivisiony;
88 
89  //Graph complet
90  vpImagePoint topLeft;
91  unsigned int width;
92  unsigned int height;
93  vpRect graphZone;
94 
95  //Zone d'affichage
96  vpImagePoint dTopLeft;
97  unsigned int dWidth;
98  unsigned int dHeight;
99  vpRect dGraphZone;
100 
101  //Zone d'affichage
102  vpImagePoint dTopLeft3D;
103 // int dWidth;
104 // int dHeight;
105  vpRect dGraphZone3D;
106 
107  //3D part
108  vpCameraParameters cam;
111  double w_xval;
112  double w_xsize;
113  double w_yval;
114  double w_ysize;
115  double w_zval;
116  double w_zsize;
117  double ptXorg;
118  double ptYorg;
119  double ptZorg;
120  double zoomx_3D;
121  double zoomy_3D;
122  double zoomz_3D;
123 
124  int nbDivisionz;
125 
126  double zorg;
127  double zoomz;
128  double zmax;
129  double zmin;
130  double zdelt;
131  char unitz[256];
132  vpImagePoint old_iPr;
133  vpImagePoint old_iPz;
134  bool blockedr;
135  bool blockedz;
136  bool blocked;
137 
138  unsigned int epsi;
139  unsigned int epsj;
140 
141  bool dispUnit;
142  bool dispTitle;
143  bool dispLegend;
144 
145 
146  public:
147  vpPlotGraph();
148  ~vpPlotGraph();
149 
150  void clearGraphZone(vpImage<unsigned char> &I);
151  void initGraph (unsigned int nbCurve);
152  void initSize (vpImagePoint topLeft, unsigned int width, unsigned int height, unsigned int margei, unsigned int margej);
153  void computeGraphParameters();
154  void computeGraphParameters3D();
155  void displayGrid (vpImage<unsigned char> &I);
156  void displayUnit (vpImage<unsigned char> &I);
157  void displayTitle (vpImage<unsigned char> &I);
158  void displayLegend (vpImage<unsigned char> &I);
159  void displayGrid3D (vpImage<unsigned char> &I);
160 
161  void setCurveColor(const unsigned int curveNum, const vpColor color);
162  void setTitle (const char *title);
163  void setUnitX (const char *unitx);
164  void setUnitY (const char *unity);
165  void setUnitZ (const char *unitz);
166  void setLegend (const unsigned int curveNum, const char *legend);
167  void setCurveThickness(const unsigned int curveNum, const unsigned int thickness);
168 
169  void rescalex(unsigned int side, double extremity);
170  void rescaley(unsigned int side, double extremity);
171  void rescalez(unsigned int side, double extremity);
172  //void rescale(double &min, double &max, double &delta, const int nbDiv, int side);
173 
174  void initScale(vpImage<unsigned char> &I, const double xmin, const double xmax, const int nbDivx, const double ymin, const double ymax, const int nbDivy, const bool gx, const bool gy);
175 
176  void initScale(vpImage<unsigned char> &I, const double xmin, const double xmax, const int nbDivx, const double ymin, const double ymax, const int nbDivy, const double zmin, const double zmax, const int nbDivz, const bool gx, const bool gy);
177 
178  void plot (vpImage<unsigned char> &I, const unsigned int curveNb, const double x, const double y);
179  void plot (vpImage<unsigned char> &I, const unsigned int curveNb, const double x, const double y, const double z);
180  void replot (vpImage<unsigned char> &I);
181  void replot3D (vpImage<unsigned char> &I);
182 
183  bool getPixelValue(vpImage<unsigned char> &I, vpImagePoint &iP);
184 
185  vpHomogeneousMatrix navigation(const vpImage<unsigned char> &I, bool &changed);
186 
187  void findPose();
188  bool move(const vpImage<unsigned char> &I);
189  bool check3Dline(vpImagePoint &iP1, vpImagePoint &iP2);
190  bool check3Dpoint(vpImagePoint &iP);
191 
192  void resetPointList(const unsigned int curveNum);
193 
194 };
195 
196 #endif
197 #endif
198 #endif
199 
The class provides a data structure for the homogeneous matrices as well as a set of operations on th...
Class to define colors available for display functionnalities.
Definition: vpColor.h:123
Generic class defining intrinsic camera parameters.
Defines a rectangle in the plane.
Definition: vpRect.h:82
Class that defines a 2D point in an image. This class is useful for image processing and stores only ...
Definition: vpImagePoint.h:92