Visual Servoing Platform  version 3.1.0
vpPlane.h
1 /****************************************************************************
2  *
3  * This file is part of the ViSP software.
4  * Copyright (C) 2005 - 2017 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(const double A, const double B, const double C, const 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  void init(const vpPoint &P, const vpPoint &Q, const vpPoint &R, vpPlaneFrame frame = camera_frame);
77  void init(const vpColVector &P, const vpColVector &n);
78  void init(const vpPlane &P);
79 
80  // SET the parameter
82  inline void setA(const double a) { this->A = a; }
84  inline void setB(const double b) { this->B = b; }
86  inline void setC(const double c) { this->C = c; }
88  inline void setD(const double d) { this->D = d; }
90  inline void setABCD(const double a, const double b, const double c, const double d)
91  {
92  this->A = a;
93  this->B = b;
94  this->C = c;
95  this->D = d;
96  }
97 
98  vpPlane &operator=(const vpPlane &f);
99 
100  // GET information
102  double getA() const { return A; }
104  double getB() const { return B; }
106  double getC() const { return C; }
108  double getD() const { return D; }
109 
116  inline vpColVector getABCD() const
117  {
118  vpColVector n(4);
119  n[0] = A;
120  n[1] = B;
121  n[2] = C;
122  n[3] = D;
123 
124  return n;
125  }
136  inline vpColVector abcd() const
137  {
138  vpColVector n(4);
139  n[0] = A;
140  n[1] = B;
141  n[2] = C;
142  n[3] = D;
143 
144  return n;
145  }
146 
147  vpColVector getNormal() const;
148  void getNormal(vpColVector &n) const;
149 
150  friend VISP_EXPORT std::ostream &operator<<(std::ostream &os, vpPlane &p);
151 
152  // Operation with Plane
153  void projectionPointOnPlan(const vpPoint &P, vpPoint &Pproj) const;
154 
155  double rayIntersection(const vpPoint &M0, const vpPoint &M1, vpColVector &H) const;
156 
157  double getIntersection(const vpColVector &M1, vpColVector &H) const;
158  void changeFrame(const vpHomogeneousMatrix &cMo);
159 };
160 
161 #endif
void setD(const double d)
Definition: vpPlane.h:88
Implementation of an homogeneous matrix and operations on such kind of matrices.
void setABCD(const double a, const double b, const double c, const double d)
Definition: vpPlane.h:90
Class that defines what is a point.
Definition: vpPoint.h:58
double D
Definition: vpPlane.h:67
double getD() const
Definition: vpPlane.h:108
double getB() const
Definition: vpPlane.h:104
void setA(const double a)
Definition: vpPlane.h:82
void setC(const double c)
Definition: vpPlane.h:86
double getA() const
Definition: vpPlane.h:102
vpColVector getABCD() const
Definition: vpPlane.h:116
Implementation of column vector and the associated operations.
Definition: vpColVector.h:72
vpColVector abcd() const
Definition: vpPlane.h:136
void setB(const double b)
Definition: vpPlane.h:84
double getC() const
Definition: vpPlane.h:106
This class defines the container for a plane geometrical structure.
Definition: vpPlane.h:58
vpPlaneFrame
Definition: vpPlane.h:70