Visual Servoing Platform
version 3.7.0
Toggle main menu visibility
Loading...
Searching...
No Matches
vpRotationVector.cpp
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
* Generic rotation vector (cannot be used as is !).
32
*/
33
39
40
#include <algorithm>
41
#include <math.h>
42
43
#include <visp3/core/vpColVector.h>
44
#include <visp3/core/vpRotationVector.h>
45
#include <visp3/core/vpRowVector.h>
46
47
BEGIN_VISP_NAMESPACE
52
vpRowVector
vpRotationVector::t
()
const
53
{
54
vpRowVector
v(
dsize
);
55
56
for
(
unsigned
int
i = 0; i <
dsize
; ++i) {
57
v[i] =
data
[i];
58
}
59
60
return
v;
61
}
62
67
std::vector<double>
vpRotationVector::toStdVector
()
const
68
{
69
std::vector<double> v(this->
size
());
70
71
unsigned
int
this_size = this->
size
();
72
for
(
unsigned
int
i = 0; i < this_size; ++i) {
73
v[i] =
data
[i];
74
}
75
return
v;
76
}
77
88
vpColVector
vpRotationVector::operator*
(
double
x)
const
89
{
90
vpColVector
v(
dsize
);
91
92
for
(
unsigned
int
i = 0; i <
dsize
; ++i) {
93
v[i] = (*this)[i] * x;
94
}
95
return
v;
96
}
97
125
vpRotationVector
&
vpRotationVector::operator<<
(
double
val)
126
{
127
m_index
= 0;
128
data
[
m_index
] = val;
129
return
*
this
;
130
}
131
159
vpRotationVector
&
vpRotationVector::operator,
(
double
val)
160
{
161
++
m_index
;
162
if
(
m_index
>=
size
()) {
163
throw
(
vpException
(
vpException::dimensionError
,
164
"Cannot set rotation vector out of bounds. It has only %d elements while you try to initialize "
165
"with %d elements"
,
166
size
(),
m_index
+ 1));
167
}
168
data
[
m_index
] = val;
169
return
*
this
;
170
}
171
178
double
vpRotationVector::sumSquare
()
const
179
{
180
double
sum_square = 0.0;
181
182
for
(
unsigned
int
i = 0; i <
rowNum
; ++i) {
183
double
x =
rowPtrs
[i][0];
184
sum_square += x * x;
185
}
186
187
return
sum_square;
188
}
189
194
vpColVector
operator*
(
const
double
&x,
const
vpRotationVector
&v)
195
{
196
vpColVector
vout;
197
vout = v * x;
198
return
vout;
199
}
200
END_VISP_NAMESPACE
vpArray2D< double >::data
double * data
Definition
vpArray2D.h:149
vpArray2D< double >::rowPtrs
double ** rowPtrs
Definition
vpArray2D.h:1205
vpArray2D< double >::rowNum
unsigned int rowNum
Definition
vpArray2D.h:1201
vpArray2D< double >::dsize
unsigned int dsize
Definition
vpArray2D.h:1207
vpArray2D< double >::size
unsigned int size() const
Definition
vpArray2D.h:435
vpColVector
Implementation of column vector and the associated operations.
Definition
vpColVector.h:191
vpException
error that can be emitted by ViSP classes.
Definition
vpException.h:60
vpException::dimensionError
@ dimensionError
Bad dimension.
Definition
vpException.h:71
vpRotationVector::m_index
unsigned int m_index
Definition
vpRotationVector.h:159
vpRotationVector::sumSquare
double sumSquare() const
Definition
vpRotationVector.cpp:178
vpRotationVector::vpRotationVector
vpRotationVector()
Constructor that constructs a 0-size rotation vector.
Definition
vpRotationVector.h:106
vpRotationVector::operator<<
vpRotationVector & operator<<(double val)
Definition
vpRotationVector.cpp:125
vpRotationVector::toStdVector
std::vector< double > toStdVector() const
Definition
vpRotationVector.cpp:67
vpRotationVector::operator*
vpColVector operator*(double x) const
Definition
vpRotationVector.cpp:88
vpRotationVector::operator*
vpColVector operator*(const double &x, const vpRotationVector &v)
Definition
vpRotationVector.cpp:194
vpRotationVector::operator,
vpRotationVector & operator,(double val)
Definition
vpRotationVector.cpp:159
vpRotationVector::t
vpRowVector t() const
Definition
vpRotationVector.cpp:52
vpRowVector
Implementation of row vector and the associated operations.
Definition
vpRowVector.h:124
BEGIN_VISP_NAMESPACE
Definition
vpMbtDistanceCircle.cpp:55
modules
core
src
math
transformation
vpRotationVector.cpp
Generated by
1.17.0