Visual Servoing Platform
version 3.7.0
Toggle main menu visibility
Loading...
Searching...
No Matches
vpScanPoint.h
1
/*
2
* ViSP, open source Visual Servoing Platform software.
3
* Copyright (C) 2005 - 2025 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
* Single laser scanner point.
32
*/
33
39
40
#ifndef vpScanPoint_h
41
#define vpScanPoint_h
42
43
#include <visp3/core/vpConfig.h>
44
#include <visp3/core/vpMath.h>
45
46
#include <cmath>
// std::fabs
47
#include <limits>
// numeric_limits
48
#include <math.h>
49
#include <ostream>
50
#include <sstream>
51
52
BEGIN_VISP_NAMESPACE
71
class
/* VISP_EXPORT */
vpScanPoint
// Note that here VISP_EXPORT should not
72
// be added since this class is complete
73
// inline
74
{
75
public
:
77
inline
vpScanPoint
() : rDist(0), hAngle(0), vAngle(0) { }
79
inline
vpScanPoint
(
const
vpScanPoint
&scanpoint) : rDist(0), hAngle(0), vAngle(0)
80
{
81
this->rDist = scanpoint.rDist;
82
this->hAngle = scanpoint.hAngle;
83
this->vAngle = scanpoint.vAngle;
84
}
85
91
inline
vpScanPoint
(
double
r_dist,
double
h_angle,
double
v_angle) : rDist(r_dist), hAngle(h_angle), vAngle(v_angle)
92
{
93
this->rDist = r_dist;
94
this->hAngle = h_angle;
95
this->vAngle = v_angle;
96
}
97
98
inline
virtual
~vpScanPoint
() { }
105
inline
void
setPolar
(
double
r_dist,
double
h_angle,
double
v_angle)
106
{
107
this->rDist = r_dist;
108
this->hAngle = h_angle;
109
this->vAngle = v_angle;
110
}
111
114
inline
double
getRadialDist
()
const
{
return
(this->rDist); }
118
inline
double
getVAngle
()
const
{
return
(this->vAngle); }
122
inline
double
getHAngle
()
const
{
return
(this->hAngle); }
130
inline
double
getX
()
const
{
return
(rDist * cos(this->hAngle) * cos(this->vAngle)); }
138
inline
double
getY
()
const
{
return
(rDist * sin(this->hAngle)); }
145
inline
double
getZ
()
const
{
return
(rDist * cos(this->hAngle) * sin(this->vAngle)); }
146
147
#if (VISP_CXX_STANDARD >= VISP_CXX_STANDARD_11)
148
vpScanPoint
&
operator=
(
const
vpScanPoint
&) =
default
;
149
#endif
150
151
friend
inline
std::ostream &
operator<<
(std::ostream &s,
const
vpScanPoint
&p);
152
158
friend
inline
bool
operator==
(
const
vpScanPoint
&sp1,
const
vpScanPoint
&sp2)
159
{
160
double
rd1 = sp1.
getRadialDist
();
161
double
ha1 = sp1.
getHAngle
();
162
double
va1 = sp1.
getVAngle
();
163
double
rd2 = sp2.
getRadialDist
();
164
double
ha2 = sp2.
getHAngle
();
165
double
va2 = sp2.
getVAngle
();
166
167
return
((std::fabs(rd1 - rd2) <= std::fabs(
vpMath::maximum
(rd1, rd2)) * std::numeric_limits<double>::epsilon()) &&
168
(std::fabs(ha1 - ha2) <= std::fabs(
vpMath::maximum
(ha1, ha2)) * std::numeric_limits<double>::epsilon()) &&
169
(std::fabs(va1 - va2) <= std::fabs(
vpMath::maximum
(va1, va2)) * std::numeric_limits<double>::epsilon()));
170
}
171
177
friend
inline
bool
operator!=
(
const
vpScanPoint
&sp1,
const
vpScanPoint
&sp2)
178
{
179
// return ( ( sp1.getRadialDist() != sp2.getRadialDist() )
180
// || ( sp1.getHAngle() != sp2.getHAngle() )
181
// || ( sp1.getVAngle() != sp2.getVAngle() ) );
182
double
rd1 = sp1.
getRadialDist
();
183
double
ha1 = sp1.
getHAngle
();
184
double
va1 = sp1.
getVAngle
();
185
double
rd2 = sp2.
getRadialDist
();
186
double
ha2 = sp2.
getHAngle
();
187
double
va2 = sp2.
getVAngle
();
188
return
((std::fabs(rd1 - rd2) > std::fabs(
vpMath::maximum
(rd1, rd2)) * std::numeric_limits<double>::epsilon()) ||
189
(std::fabs(ha1 - ha2) <= std::fabs(
vpMath::maximum
(ha1, ha2)) * std::numeric_limits<double>::epsilon()) ||
190
(std::fabs(va1 - va2) <= std::fabs(
vpMath::maximum
(va1, va2)) * std::numeric_limits<double>::epsilon()));
191
}
192
193
private
:
194
double
rDist;
195
double
hAngle;
196
double
vAngle;
197
};
198
240
inline
std::ostream &
operator<<
(std::ostream &s,
const
vpScanPoint
&p)
241
{
242
std::ios_base::fmtflags original_flags = s.flags();
243
244
s.precision(10);
245
s << p.getRadialDist() <<
" "
<< p.getHAngle() <<
" "
<< p.getVAngle() <<
" "
<< p.getX() <<
" "
<< p.getY() <<
" "
246
<< p.getZ();
247
248
s.setf(original_flags);
// restore s to standard state
249
250
return
s;
251
}
252
END_VISP_NAMESPACE
253
#endif
vpMath::maximum
static Type maximum(const Type &a, const Type &b)
Definition
vpMath.h:257
vpScanPoint::getX
double getX() const
Definition
vpScanPoint.h:130
vpScanPoint::~vpScanPoint
virtual ~vpScanPoint()
Definition
vpScanPoint.h:98
vpScanPoint::operator!=
friend bool operator!=(const vpScanPoint &sp1, const vpScanPoint &sp2)
Definition
vpScanPoint.h:177
vpScanPoint::operator<<
friend std::ostream & operator<<(std::ostream &s, const vpScanPoint &p)
Definition
vpScanPoint.h:240
vpScanPoint::vpScanPoint
vpScanPoint(double r_dist, double h_angle, double v_angle)
Definition
vpScanPoint.h:91
vpScanPoint::getVAngle
double getVAngle() const
Definition
vpScanPoint.h:118
vpScanPoint::getZ
double getZ() const
Definition
vpScanPoint.h:145
vpScanPoint::setPolar
void setPolar(double r_dist, double h_angle, double v_angle)
Definition
vpScanPoint.h:105
vpScanPoint::getY
double getY() const
Definition
vpScanPoint.h:138
vpScanPoint::operator=
vpScanPoint & operator=(const vpScanPoint &)=default
vpScanPoint::vpScanPoint
vpScanPoint(const vpScanPoint &scanpoint)
Definition
vpScanPoint.h:79
vpScanPoint::getRadialDist
double getRadialDist() const
Definition
vpScanPoint.h:114
vpScanPoint::getHAngle
double getHAngle() const
Definition
vpScanPoint.h:122
vpScanPoint::vpScanPoint
vpScanPoint()
Definition
vpScanPoint.h:77
vpScanPoint::operator==
friend bool operator==(const vpScanPoint &sp1, const vpScanPoint &sp2)
Definition
vpScanPoint.h:158
BEGIN_VISP_NAMESPACE
Definition
vpMbtDistanceCircle.cpp:55
modules
sensor
include
visp3
sensor
vpScanPoint.h
Generated by
1.17.0