Visual Servoing Platform version 3.7.0
Loading...
Searching...
No Matches
vpRotationVector.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 * Generic rotation vector (cannot be used as is !).
32 */
33
39
40#ifndef VP_ROTATION_VECTOR_H
41#define VP_ROTATION_VECTOR_H
42
43#include <iostream>
44#include <math.h>
45#include <stdio.h>
46
47#include <visp3/core/vpConfig.h>
48#include <visp3/core/vpArray2D.h>
49
51
52class vpRowVector;
53class vpColVector;
54
101
102class VISP_EXPORT vpRotationVector : public vpArray2D<double>
103{
104public:
106 vpRotationVector() : vpArray2D<double>(), m_index(0) { }
107
110 VP_EXPLICIT vpRotationVector(unsigned int n) : vpArray2D<double>(n, 1), m_index(0) { }
111
115 vpRotationVector(const vpRotationVector &v) : vpArray2D<double>(v), m_index(0) { }
116
119
124 inline double &operator[](unsigned int i) { return *(data + i); }
129 inline const double &operator[](unsigned int i) const { return *(data + i); }
130
135 {
136 resize(v.size(), 1);
137 unsigned int v_size = v.size();
138 for (unsigned int i = 0; i < v_size; ++i) {
139 data[i] = v.data[i];
140 }
141 return *this;
142 }
143
144 vpColVector operator*(double x) const;
145
146 vpRotationVector &operator<<(double val);
147 vpRotationVector &operator,(double val);
148
149 double sumSquare() const;
150
151 // Transpose of the rotation vector.
152 vpRowVector t() const;
153
154 std::vector<double> toStdVector() const;
155
157
158protected:
159 unsigned int m_index; // index used for operator<< and operator, to fill a vector
160};
161
162#ifndef DOXYGEN_SHOULD_SKIP_THIS
163VISP_EXPORT
164#endif
165VISP_NAMESPACE_ADDRESSING vpColVector operator*(const double &x, const VISP_NAMESPACE_ADDRESSING vpRotationVector &v);
166END_VISP_NAMESPACE
167#endif
void resize(unsigned int nrows, unsigned int ncols, bool flagNullify=true, bool recopy_=true)
Definition vpArray2D.h:448
friend std::ostream & operator<<(std::ostream &s, const vpArray2D< Type > &A)
Definition vpArray2D.h:705
vpArray2D< Type > t() const
Compute the transpose of the array.
Definition vpArray2D.h:1273
Implementation of column vector and the associated operations.
Implementation of a generic rotation vector.
double & operator[](unsigned int i)
vpRotationVector(const vpRotationVector &v)
vpRotationVector & operator=(const vpRotationVector &v)
vpRotationVector()
Constructor that constructs a 0-size rotation vector.
const double & operator[](unsigned int i) const
VP_EXPLICIT vpRotationVector(unsigned int n)
Implementation of row vector and the associated operations.