Visual Servoing Platform  version 3.0.0
vpRotationVector.h
1 /****************************************************************************
2  *
3  * This file is part of the ViSP software.
4  * Copyright (C) 2005 - 2015 by Inria. All rights reserved.
5  *
6  * This software is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License
8  * ("GPL") version 2 as published by the Free Software Foundation.
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 http://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  * Authors:
34  * Eric Marchand
35  *
36  *****************************************************************************/
37 
38 #ifndef vpRotationVECTOR_H
39 #define vpRotationVECTOR_H
40 
47 #include <iostream>
48 #include <math.h>
49 #include <stdio.h>
50 
51 #include <visp3/core/vpArray2D.h>
52 
53 class vpRowVector;
54 class vpColVector;
55 
94 class VISP_EXPORT vpRotationVector : public vpArray2D<double>
95 {
96 public:
99  : vpArray2D<double>()
100  {}
101 
103  vpRotationVector(const unsigned int n)
104  : vpArray2D<double>(n, 1)
105  {}
106 
111  : vpArray2D<double>(v)
112  {}
113 
117  virtual ~vpRotationVector() {};
118 
121 
126  inline double &operator [](unsigned int i) { return *(data + i); }
131  inline const double &operator [](unsigned int i) const { return *(data+i); }
132 
137  {
138  resize(v.size(), 1);
139  for (unsigned int i=0; i<v.size(); i++)
140  {
141  data[i] = v.data[i] ;
142  }
143  return *this;
144  }
145  vpColVector operator*(double x) const;
146 
147  double sumSquare() const;
148 
149  // Transpose of the rotation vector.
150  vpRowVector t() const;
151 
153 } ;
154 
155 #ifndef DOXYGEN_SHOULD_SKIP_THIS
156 VISP_EXPORT
157 #endif
158 vpColVector operator*(const double &x, const vpRotationVector &v) ;
159 
160 #endif
161 
vpRotationVector & operator=(const vpRotationVector &v)
Implementation of a generic rotation vector.
virtual ~vpRotationVector()
void resize(const unsigned int nrows, const unsigned int ncols, const bool flagNullify=true)
Definition: vpArray2D.h:167
Implementation of row vector and the associated operations.
Definition: vpRowVector.h:70
vpColVector operator*(const double &x, const vpColVector &v)
Type * data
Address of the first element of the data array.
Definition: vpArray2D.h:84
Implementation of a generic 2D array used as vase class of matrices and vectors.
Definition: vpArray2D.h:70
unsigned int size() const
Return the number of elements of the 2D array.
Definition: vpArray2D.h:156
vpRotationVector(const vpRotationVector &v)
vpRotationVector(const unsigned int n)
Constructor that constructs a vector of size n and initialize all values to zero. ...
vpColVector operator*(const double &x, const vpColVector &v)
vpRotationVector()
Constructor that constructs a 0-size rotation vector.
Type * operator[](unsigned int i)
Set element using A[i][j] = x.
Definition: vpArray2D.h:259
Implementation of column vector and the associated operations.
Definition: vpColVector.h:72