Visual Servoing Platform version 3.7.0
Loading...
Searching...
No Matches
vpPlane.h
1/*
2 * ViSP, open source Visual Servoing Platform software.
3 * Copyright (C) 2005 - 2024 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 VP_PLANE_H
35#define VP_PLANE_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
55class VISP_EXPORT vpPlane
56{
57#ifdef VISP_BUILD_DEPRECATED_FUNCTIONS
58 // for backward compatibility
59public:
60 double A, B, C, D;
61#endif
62
63public:
64 typedef enum { object_frame, camera_frame } vpPlaneFrame;
65 vpPlane();
66 vpPlane(const vpPlane &P);
67 vpPlane(double A, double B, double C, double D);
68 vpPlane(const vpPoint &P, const vpColVector &normal, const vpPlaneFrame &frame = camera_frame);
69 vpPlane(const vpPoint &P, const vpPoint &Q, const vpPoint &R, const vpPlaneFrame &frame = camera_frame);
70
71 double computeZ(double x, double y) const;
72
73 vpPlane &init(const vpPoint &P, const vpColVector &normal, const vpPlaneFrame &frame = camera_frame);
74 vpPlane &init(const vpPoint &P, const vpPoint &Q, const vpPoint &R, const vpPlaneFrame &frame = camera_frame);
75 vpPlane &init(const vpColVector &P, const vpColVector &n);
76 vpPlane &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 const unsigned int index_0 = 0;
117 const unsigned int index_1 = 1;
118 const unsigned int index_2 = 2;
119 const unsigned int index_3 = 3;
120 vpColVector n(4);
121 n[index_0] = A;
122 n[index_1] = B;
123 n[index_2] = C;
124 n[index_3] = D;
125
126 return n;
127 }
128
139 inline vpColVector abcd() const
140 {
141 const unsigned int index_0 = 0;
142 const unsigned int index_1 = 1;
143 const unsigned int index_2 = 2;
144 const unsigned int index_3 = 3;
145 vpColVector n(4);
146 n[index_0] = A;
147 n[index_1] = B;
148 n[index_2] = C;
149 n[index_3] = D;
150
151 return n;
152 }
153
154 vpColVector getNormal() const;
155 void getNormal(vpColVector &n) const;
156
157 friend VISP_EXPORT std::ostream &operator<<(std::ostream &os, const vpPlane &p);
158
159 // Operation with Plane
160 void projectionPointOnPlan(const vpPoint &P, vpPoint &Pproj, const vpPlaneFrame &frame = camera_frame) const;
161
162 double rayIntersection(const vpPoint &M0, const vpPoint &M1, vpColVector &H) const;
163
164 double getIntersection(const vpColVector &M1, vpColVector &H) const;
165 void changeFrame(const vpHomogeneousMatrix &cMo);
166
167#ifndef VISP_BUILD_DEPRECATED_FUNCTIONS
168private:
169 double A, B, C, D;
170#endif
171};
172END_VISP_NAMESPACE
173#endif
Implementation of column vector and the associated operations.
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:56
double C
Definition vpPlane.h:60
vpColVector abcd() const
Definition vpPlane.h:139
@ camera_frame
Definition vpPlane.h:64
@ object_frame
Definition vpPlane.h:64
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:60
double D
Definition vpPlane.h:60
double getD() const
Definition vpPlane.h:106
void setC(double c)
Definition vpPlane.h:84
double B
Definition vpPlane.h:60
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
vpPlane()
Definition vpPlane.cpp:61
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:79