Visual Servoing Platform  version 3.6.1 under development (2024-03-04)
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_hh
35 #define vpPlane_hh
36 
37 #include <visp3/core/vpColVector.h>
38 #include <visp3/core/vpHomogeneousMatrix.h>
39 #include <visp3/core/vpPoint.h>
40 
53 class VISP_EXPORT vpPlane
54 {
55 
56 #ifdef VISP_BUILD_DEPRECATED_FUNCTIONS
57  // for backward compatibility
58 public:
59 #else
60 private:
61 #endif
62  double A, B, C, D;
63 
64 public:
65  typedef enum { object_frame, camera_frame } vpPlaneFrame;
66  vpPlane();
67  vpPlane(const vpPlane &P);
68  vpPlane(double A, double B, double C, double D);
69  vpPlane(const vpPoint &P, const vpColVector &n, vpPlaneFrame frame = camera_frame);
70  vpPlane(const vpPoint &P, const vpPoint &Q, const vpPoint &R, vpPlaneFrame frame = camera_frame);
71 
72  double computeZ(double x, double y) const;
73 
74  void init(const vpPoint &P, const vpPoint &Q, const vpPoint &R, vpPlaneFrame frame = camera_frame);
75  void init(const vpColVector &P, const vpColVector &n);
76  void init(const vpPlane &P);
77 
78  // SET the parameter
80  inline void setA(double a) { this->A = a; }
82  inline void setB(double b) { this->B = b; }
84  inline void setC(double c) { this->C = c; }
86  inline void setD(double d) { this->D = d; }
88  inline void setABCD(double a, double b, double c, double d)
89  {
90  this->A = a;
91  this->B = b;
92  this->C = c;
93  this->D = d;
94  }
95 
96  vpPlane &operator=(const vpPlane &f);
97 
98  // GET information
100  double getA() const { return A; }
102  double getB() const { return B; }
104  double getC() const { return C; }
106  double getD() const { return D; }
107 
114  inline vpColVector getABCD() const
115  {
116  vpColVector n(4);
117  n[0] = A;
118  n[1] = B;
119  n[2] = C;
120  n[3] = D;
121 
122  return n;
123  }
134  inline vpColVector abcd() const
135  {
136  vpColVector n(4);
137  n[0] = A;
138  n[1] = B;
139  n[2] = C;
140  n[3] = D;
141 
142  return n;
143  }
144 
145  vpColVector getNormal() const;
146  void getNormal(vpColVector &n) const;
147 
148  friend VISP_EXPORT std::ostream &operator<<(std::ostream &os, vpPlane &p);
149 
150  // Operation with Plane
151  void projectionPointOnPlan(const vpPoint &P, vpPoint &Pproj) const;
152 
153  double rayIntersection(const vpPoint &M0, const vpPoint &M1, vpColVector &H) const;
154 
155  double getIntersection(const vpColVector &M1, vpColVector &H) const;
156  void changeFrame(const vpHomogeneousMatrix &cMo);
157 };
158 
159 #endif
Implementation of column vector and the associated operations.
Definition: vpColVector.h:163
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:54
vpColVector abcd() const
Definition: vpPlane.h:134
void setA(double a)
Definition: vpPlane.h:80
vpColVector getABCD() const
Definition: vpPlane.h:114
void setD(double d)
Definition: vpPlane.h:86
double A
Definition: vpPlane.h:62
double getD() const
Definition: vpPlane.h:106
void setC(double c)
Definition: vpPlane.h:84
double getA() const
Definition: vpPlane.h:100
double getC() const
Definition: vpPlane.h:104
void setABCD(double a, double b, double c, double d)
Definition: vpPlane.h:88
double getB() const
Definition: vpPlane.h:102
void setB(double b)
Definition: vpPlane.h:82
Class that defines a 3D point in the object frame and allows forward projection of a 3D point in the ...
Definition: vpPoint.h:77