Visual Servoing Platform  version 3.3.1 under development (2020-12-02)
vpPoint.h
1 /****************************************************************************
2  *
3  * ViSP, open source Visual Servoing Platform software.
4  * Copyright (C) 2005 - 2019 by Inria. All rights reserved.
5  *
6  * This software is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  * See the file LICENSE.txt at the root directory of this source
11  * distribution for additional information about the GNU GPL.
12  *
13  * For using ViSP with software that can not be combined with the GNU
14  * GPL, please contact Inria about acquiring a ViSP Professional
15  * Edition License.
16  *
17  * See http://visp.inria.fr for more information.
18  *
19  * This software was developed at:
20  * Inria Rennes - Bretagne Atlantique
21  * Campus Universitaire de Beaulieu
22  * 35042 Rennes Cedex
23  * France
24  *
25  * If you have questions regarding the use of this file, please contact
26  * Inria at visp@inria.fr
27  *
28  * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
29  * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
30  *
31  * Description:
32  * Point feature.
33  *
34  * Authors:
35  * Eric Marchand
36  *
37  *****************************************************************************/
38 
39 #ifndef vpPoint_H
40 #define vpPoint_H
41 
48 
49 #include <visp3/core/vpColor.h>
50 #include <visp3/core/vpForwardProjection.h>
51 #include <visp3/core/vpMatrix.h>
52 
81 class VISP_EXPORT vpPoint : public vpForwardProjection
82 {
83 
84 public:
86  vpPoint();
87  vpPoint(double oX, double oY, double oZ);
88  explicit vpPoint(const vpColVector &oP);
89  explicit vpPoint(const std::vector<double> &oP);
91  virtual ~vpPoint() {}
92 
93 public:
94  // Compute the 3D coordinates _cP (camera frame)
95  void changeFrame(const vpHomogeneousMatrix &cMo, vpColVector &cP) const;
96  void changeFrame(const vpHomogeneousMatrix &cMo);
97 
98  void display(const vpImage<unsigned char> &I, const vpCameraParameters &cam, const vpColor &color = vpColor::green,
99  unsigned int thickness = 1);
100  void display(const vpImage<unsigned char> &I, const vpHomogeneousMatrix &cMo, const vpCameraParameters &cam,
101  const vpColor &color = vpColor::green, unsigned int thickness = 1);
102  void display(const vpImage<vpRGBa> &I, const vpHomogeneousMatrix &cMo, const vpCameraParameters &cam,
103  const vpColor &color = vpColor::green, unsigned int thickness = 1);
104  vpPoint *duplicate() const;
105 
106  // Get coordinates
107  double get_X() const;
108  double get_Y() const;
109  double get_Z() const;
110  double get_W() const;
111  double get_oX() const;
112  double get_oY() const;
113  double get_oZ() const;
114  double get_oW() const;
115  double get_x() const;
116  double get_y() const;
117  double get_w() const;
118 
119  void getWorldCoordinates(double &oX, double &oY, double &oZ);
120  void getWorldCoordinates(vpColVector &oP);
121  vpColVector getWorldCoordinates(void);
122  void getWorldCoordinates(std::vector<double> &oP);
123 
124  friend VISP_EXPORT std::ostream &operator<<(std::ostream &os, const vpPoint &vpp);
125 #if (VISP_CXX_STANDARD >= VISP_CXX_STANDARD_11)
126  vpPoint &operator=(const vpPoint &vpp) = default;
127 #else
128  vpPoint &operator=(const vpPoint &vpp);
129 #endif
130 
133  void projection(const vpColVector &_cP, vpColVector &_p) const;
134 
135  void projection();
136 
137  // Set coordinates
138  void set_X(double cX);
139  void set_Y(double cY);
140  void set_Z(double cZ);
141  void set_W(double cW);
142  void set_oX(double oX);
143  void set_oY(double oY);
144  void set_oZ(double oZ);
145  void set_oW(double oW);
146  void set_x(double x);
147  void set_y(double y);
148  void set_w(double w);
149 
150  void setWorldCoordinates(double oX, double oY, double oZ);
151  void setWorldCoordinates(const vpColVector &oP);
152  void setWorldCoordinates(const std::vector<double> &oP);
153 
154 protected:
156  void init();
157 };
158 
159 #endif
virtual void changeFrame(const vpHomogeneousMatrix &cMo, vpColVector &cP) const =0
vpTracker & operator=(const vpTracker &tracker)
Copy operator.
Definition: vpTracker.cpp:53
virtual void display(const vpImage< unsigned char > &I, const vpCameraParameters &cam, const vpColor &color=vpColor::green, unsigned int thickness=1)=0
Implementation of an homogeneous matrix and operations on such kind of matrices.
Class to define RGB colors available for display functionnalities.
Definition: vpColor.h:157
virtual void init()=0
static const vpColor green
Definition: vpColor.h:220
Class that defines a 3D point in the object frame and allows forward projection of a 3D point in the ...
Definition: vpPoint.h:81
virtual void projection()=0
virtual ~vpPoint()
Destructor.
Definition: vpPoint.h:91
Class that defines what is a generic geometric feature.
virtual void setWorldCoordinates(const vpColVector &oP)=0
Generic class defining intrinsic camera parameters.
Implementation of column vector and the associated operations.
Definition: vpColVector.h:130
virtual vpForwardProjection * duplicate() const =0