Visual Servoing Platform version 3.6.0
Loading...
Searching...
No Matches
vpRotationVector.h
1/*
2 * ViSP, open source Visual Servoing Platform software.
3 * Copyright (C) 2005 - 2023 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
34#ifndef _vpRotationVector_h_
35#define _vpRotationVector_h_
36
43#include <iostream>
44#include <math.h>
45#include <stdio.h>
46
47#include <visp3/core/vpArray2D.h>
48
49class vpRowVector;
50class vpColVector;
51
95class VISP_EXPORT vpRotationVector : public vpArray2D<double>
96{
97public:
99 vpRotationVector() : vpArray2D<double>(), m_index(0) {}
100
103 explicit vpRotationVector(unsigned int n) : vpArray2D<double>(n, 1), m_index(0) {}
104
108 vpRotationVector(const vpRotationVector &v) : vpArray2D<double>(v), m_index(0) {}
109
114
117
122 inline double &operator[](unsigned int i) { return *(data + i); }
127 inline const double &operator[](unsigned int i) const { return *(data + i); }
128
133 {
134 resize(v.size(), 1);
135 for (unsigned int i = 0; i < v.size(); i++) {
136 data[i] = v.data[i];
137 }
138 return *this;
139 }
140
141 vpColVector operator*(double x) const;
142
143 vpRotationVector &operator<<(double val);
144 vpRotationVector &operator,(double val);
145
146 double sumSquare() const;
147
148 // Transpose of the rotation vector.
149 vpRowVector t() const;
150
151 std::vector<double> toStdVector() const;
152
154
155protected:
156 unsigned int m_index; // index used for operator<< and operator, to fill a vector
157};
158
159#ifndef DOXYGEN_SHOULD_SKIP_THIS
160VISP_EXPORT
161#endif
162vpColVector operator*(const double &x, const vpRotationVector &v);
163
164#endif
Implementation of a generic 2D array used as base class for matrices and vectors.
Definition vpArray2D.h:131
Type * data
Address of the first element of the data array.
Definition vpArray2D.h:144
void resize(unsigned int nrows, unsigned int ncols, bool flagNullify=true, bool recopy_=true)
Definition vpArray2D.h:305
friend std::ostream & operator<<(std::ostream &s, const vpArray2D< Type > &A)
Definition vpArray2D.h:529
unsigned int size() const
Return the number of elements of the 2D array.
Definition vpArray2D.h:292
vpArray2D< Type > t() const
Compute the transpose of the array.
Definition vpArray2D.h:1059
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.
virtual ~vpRotationVector()
const double & operator[](unsigned int i) const
vpRotationVector(unsigned int n)
Implementation of row vector and the associated operations.
vpColVector operator*(const double &x, const vpColVector &v)