Visual Servoing Platform  version 3.0.1
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
vpTranslationVector.h
1 /****************************************************************************
2  *
3  * This file is part of the ViSP software.
4  * Copyright (C) 2005 - 2017 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  * Translation vector.
32  *
33  * Authors:
34  * Eric Marchand
35  * Fabien Spindler
36  *
37  *****************************************************************************/
38 
39 
40 
41 #ifndef vpTRANSLATIONVECTOR_H
42 #define vpTRANSLATIONVECTOR_H
43 
49 #include <visp3/core/vpArray2D.h>
50 #include <visp3/core/vpMatrix.h>
51 #include <visp3/core/vpHomogeneousMatrix.h>
52 #include <visp3/core/vpPoseVector.h>
53 
54 
93 class VISP_EXPORT vpTranslationVector : public vpArray2D<double>
94 {
95 public:
96 
101  vpTranslationVector() : vpArray2D<double>(3, 1) {};
102  vpTranslationVector(const double tx, const double ty, const double tz) ;
107 
108  vpTranslationVector buildFrom(const double tx, const double ty, const double tz) ;
109  vpTranslationVector buildFrom(const vpHomogeneousMatrix& M) ;
110  vpTranslationVector buildFrom(const vpPoseVector& p) ;
111  vpTranslationVector buildFrom(const vpColVector& v) ;
112 
113  double euclideanNorm() const;
114 
115  // operators
116 
117  // translation vectors additions c = a + b (a, b unchanged)
118  vpTranslationVector operator+(const vpTranslationVector &tv) const ;
119  vpTranslationVector operator+(const vpColVector &v) const;
120  // translation vectors substraction c = a - b (a, b unchanged)
121  vpTranslationVector operator-(const vpTranslationVector &tv) const ;
122  // negate t = -a (t is unchanged)
123  vpTranslationVector operator-() const ;
124  vpMatrix operator*(const vpRowVector &v) const;
125  // b = x * a (x=scalar)
126  vpTranslationVector operator*(const double x) const;
127  vpTranslationVector & operator*=(double x);
128  vpTranslationVector operator/(const double x) const;
129  vpTranslationVector & operator/=(double x);
130  // Copy operator. Allow operation such as A = v
133 
134  vpTranslationVector &operator=(double x) ;
135 
137  inline double &operator [](unsigned int n) { return *(data + n); }
139  inline const double &operator [](unsigned int n) const { return *(data+n); }
140 
146  void resize(const unsigned int nrows, const unsigned int ncols,
147  const bool flagNullify = true)
148  {
149  (void)nrows;
150  (void)ncols;
151  (void)flagNullify;
152  throw(vpException(vpException::fatalError, "Cannot resize a translation vector"));
153  };
154 
155  void set(const double tx, const double ty, const double tz) ;
156 
157  // Skew Symmetric matrix
158  vpMatrix skew() const ;
159 
160  double sumSquare() const;
161 
162  vpRowVector t() const;
163 
164  static vpTranslationVector cross(const vpTranslationVector &a,
165  const vpTranslationVector &b) ;
166  static vpMatrix skew(const vpTranslationVector &tv) ;
167  static void skew(const vpTranslationVector &tv, vpMatrix &M) ;
168 } ;
169 
170 #endif
Implementation of a matrix and operations on matrices.
Definition: vpMatrix.h:97
vpArray2D< Type > & operator=(Type x)
Set all the elements of the array to x.
Definition: vpArray2D.h:239
Implementation of an homogeneous matrix and operations on such kind of matrices.
Implementation of row vector and the associated operations.
Definition: vpRowVector.h:70
error that can be emited by ViSP classes.
Definition: vpException.h:73
Implementation of a generic 2D array used as vase class of matrices and vectors.
Definition: vpArray2D.h:70
vpColVector operator*(const double &x, const vpColVector &v)
void resize(const unsigned int nrows, const unsigned int ncols, const bool flagNullify=true)
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
Implementation of a pose vector and operations on poses.
Definition: vpPoseVector.h:93
Class that consider the case of a translation vector.