Visual Servoing Platform  version 3.5.1 under development (2023-03-29)
vpPlane.h
1 /****************************************************************************
2  *
3  * ViSP, open source Visual Servoing Platform software.
4  * Copyright (C) 2005 - 2022 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  * Plane geometrical structure.
33  *
34  * Authors:
35  * Eric Marchand
36  *
37  *****************************************************************************/
38 
39 #ifndef vpPlane_hh
40 #define vpPlane_hh
41 
42 #include <visp3/core/vpColVector.h>
43 #include <visp3/core/vpHomogeneousMatrix.h>
44 #include <visp3/core/vpPoint.h>
45 
58 class VISP_EXPORT vpPlane
59 {
60 
61 #ifdef VISP_BUILD_DEPRECATED_FUNCTIONS
62  // for backward compatibility
63 public:
64 #else
65 private:
66 #endif
67  double A, B, C, D;
68 
69 public:
70  typedef enum { object_frame, camera_frame } vpPlaneFrame;
71  vpPlane();
72  vpPlane(const vpPlane &P);
73  vpPlane(double A, double B, double C, double D);
74  vpPlane(const vpPoint &P, const vpColVector &n, vpPlaneFrame frame = camera_frame);
75  vpPlane(const vpPoint &P, const vpPoint &Q, const vpPoint &R, vpPlaneFrame frame = camera_frame);
76 
77  double computeZ(double x, double y) const;
78 
79  void init(const vpPoint &P, const vpPoint &Q, const vpPoint &R, vpPlaneFrame frame = camera_frame);
80  void init(const vpColVector &P, const vpColVector &n);
81  void init(const vpPlane &P);
82 
83  // SET the parameter
85  inline void setA(double a) { this->A = a; }
87  inline void setB(double b) { this->B = b; }
89  inline void setC(double c) { this->C = c; }
91  inline void setD(double d) { this->D = d; }
93  inline void setABCD(double a, double b, double c, double d)
94  {
95  this->A = a;
96  this->B = b;
97  this->C = c;
98  this->D = d;
99  }
100 
101  vpPlane &operator=(const vpPlane &f);
102 
103  // GET information
105  double getA() const { return A; }
107  double getB() const { return B; }
109  double getC() const { return C; }
111  double getD() const { return D; }
112 
119  inline vpColVector getABCD() const
120  {
121  vpColVector n(4);
122  n[0] = A;
123  n[1] = B;
124  n[2] = C;
125  n[3] = D;
126 
127  return n;
128  }
139  inline vpColVector abcd() const
140  {
141  vpColVector n(4);
142  n[0] = A;
143  n[1] = B;
144  n[2] = C;
145  n[3] = D;
146 
147  return n;
148  }
149 
150  vpColVector getNormal() const;
151  void getNormal(vpColVector &n) const;
152 
153  friend VISP_EXPORT std::ostream &operator<<(std::ostream &os, vpPlane &p);
154 
155  // Operation with Plane
156  void projectionPointOnPlan(const vpPoint &P, vpPoint &Pproj) const;
157 
158  double rayIntersection(const vpPoint &M0, const vpPoint &M1, vpColVector &H) const;
159 
160  double getIntersection(const vpColVector &M1, vpColVector &H) const;
161  void changeFrame(const vpHomogeneousMatrix &cMo);
162 };
163 
164 #endif
Implementation of column vector and the associated operations.
Definition: vpColVector.h:131
Implementation of an homogeneous matrix and operations on such kind of matrices.
This class defines the container for a plane geometrical structure.
Definition: vpPlane.h:59
vpColVector abcd() const
Definition: vpPlane.h:139
void setA(double a)
Definition: vpPlane.h:85
vpColVector getABCD() const
Definition: vpPlane.h:119
void setD(double d)
Definition: vpPlane.h:91
double A
Definition: vpPlane.h:67
double getD() const
Definition: vpPlane.h:111
void setC(double c)
Definition: vpPlane.h:89
double getA() const
Definition: vpPlane.h:105
double getC() const
Definition: vpPlane.h:109
void setABCD(double a, double b, double c, double d)
Definition: vpPlane.h:93
double getB() const
Definition: vpPlane.h:107
void setB(double b)
Definition: vpPlane.h:87
Class that defines a 3D point in the object frame and allows forward projection of a 3D point in the ...
Definition: vpPoint.h:82