Visual Servoing Platform  version 3.6.1 under development (2024-06-12)
vpPlane.h
1 /*
2  * ViSP, open source Visual Servoing Platform software.
3  * Copyright (C) 2005 - 2023 by Inria. All rights reserved.
4  *
5  * This software is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 2 of the License, or
8  * (at your option) any later version.
9  * See the file LICENSE.txt at the root directory of this source
10  * distribution for additional information about the GNU GPL.
11  *
12  * For using ViSP with software that can not be combined with the GNU
13  * GPL, please contact Inria about acquiring a ViSP Professional
14  * Edition License.
15  *
16  * See https://visp.inria.fr for more information.
17  *
18  * This software was developed at:
19  * Inria Rennes - Bretagne Atlantique
20  * Campus Universitaire de Beaulieu
21  * 35042 Rennes Cedex
22  * France
23  *
24  * If you have questions regarding the use of this file, please contact
25  * Inria at visp@inria.fr
26  *
27  * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
28  * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
29  *
30  * Description:
31  * Plane geometrical structure.
32  */
33 
34 #ifndef _vpPlane_h_
35 #define _vpPlane_h_
36 
37 #include <visp3/core/vpConfig.h>
38 #include <visp3/core/vpColVector.h>
39 #include <visp3/core/vpHomogeneousMatrix.h>
40 #include <visp3/core/vpPoint.h>
41 
43 
56 class VISP_EXPORT vpPlane
57 {
58 
59 #ifdef VISP_BUILD_DEPRECATED_FUNCTIONS
60  // for backward compatibility
61 public:
62 #else
63 private:
64 #endif
65  double A, B, C, D;
66 
67 public:
68  typedef enum { object_frame, camera_frame } vpPlaneFrame;
69  vpPlane();
70  vpPlane(const vpPlane &P);
71  vpPlane(double A, double B, double C, double D);
72  vpPlane(const vpPoint &P, const vpColVector &n, vpPlaneFrame frame = camera_frame);
73  vpPlane(const vpPoint &P, const vpPoint &Q, const vpPoint &R, vpPlaneFrame frame = camera_frame);
74 
75  double computeZ(double x, double y) const;
76 
77  void init(const vpPoint &P, const vpPoint &Q, const vpPoint &R, vpPlaneFrame frame = camera_frame);
78  void init(const vpColVector &P, const vpColVector &n);
79  void init(const vpPlane &P);
80 
81  // SET the parameter
83  inline void setA(double a) { this->A = a; }
85  inline void setB(double b) { this->B = b; }
87  inline void setC(double c) { this->C = c; }
89  inline void setD(double d) { this->D = d; }
91  inline void setABCD(double a, double b, double c, double d)
92  {
93  this->A = a;
94  this->B = b;
95  this->C = c;
96  this->D = d;
97  }
98 
99  vpPlane &operator=(const vpPlane &f);
100 
101  // GET information
103  double getA() const { return A; }
105  double getB() const { return B; }
107  double getC() const { return C; }
109  double getD() const { return D; }
110 
117  inline vpColVector getABCD() const
118  {
119  vpColVector n(4);
120  n[0] = A;
121  n[1] = B;
122  n[2] = C;
123  n[3] = D;
124 
125  return n;
126  }
137  inline vpColVector abcd() const
138  {
139  vpColVector n(4);
140  n[0] = A;
141  n[1] = B;
142  n[2] = C;
143  n[3] = D;
144 
145  return n;
146  }
147 
148  vpColVector getNormal() const;
149  void getNormal(vpColVector &n) const;
150 
151  friend VISP_EXPORT std::ostream &operator<<(std::ostream &os, const vpPlane &p);
152 
153  // Operation with Plane
154  void projectionPointOnPlan(const vpPoint &P, vpPoint &Pproj) const;
155 
156  double rayIntersection(const vpPoint &M0, const vpPoint &M1, vpColVector &H) const;
157 
158  double getIntersection(const vpColVector &M1, vpColVector &H) const;
159  void changeFrame(const vpHomogeneousMatrix &cMo);
160 };
162 #endif
Implementation of column vector and the associated operations.
Definition: vpColVector.h:171
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:57
vpColVector abcd() const
Definition: vpPlane.h:137
void setA(double a)
Definition: vpPlane.h:83
vpColVector getABCD() const
Definition: vpPlane.h:117
void setD(double d)
Definition: vpPlane.h:89
double A
Definition: vpPlane.h:65
double getD() const
Definition: vpPlane.h:109
void setC(double c)
Definition: vpPlane.h:87
double getA() const
Definition: vpPlane.h:103
double getC() const
Definition: vpPlane.h:107
void setABCD(double a, double b, double c, double d)
Definition: vpPlane.h:91
double getB() const
Definition: vpPlane.h:105
void setB(double b)
Definition: vpPlane.h:85
Class that defines a 3D point in the object frame and allows forward projection of a 3D point in the ...
Definition: vpPoint.h:79