42 #include <visp3/core/vpTranslationVector.h>
54 const unsigned int index_0 = 0;
55 const unsigned int index_1 = 1;
56 const unsigned int index_2 = 2;
57 (*this)[index_0] = tx;
58 (*this)[index_1] = ty;
59 (*this)[index_2] = tz;
83 const unsigned int index_0 = 0;
84 const unsigned int index_1 = 1;
85 const unsigned int index_2 = 2;
86 (*this)[index_0] = p[index_0];
87 (*this)[index_1] = p[index_1];
88 (*this)[index_2] = p[index_2];
121 "Cannot construct a translation vector from a "
122 "%d-dimension column vector",
155 const unsigned int index_0 = 0;
156 const unsigned int index_1 = 1;
157 const unsigned int index_2 = 2;
158 (*this)[index_0] = p[index_0];
159 (*this)[index_1] = p[index_1];
160 (*this)[index_2] = p[index_2];
175 const unsigned int index_0 = 0;
176 const unsigned int index_1 = 1;
177 const unsigned int index_2 = 2;
178 const unsigned int v_size = 3;
179 if (v.
size() != v_size) {
181 "Cannot build a translation vector from a %d-dimension column vector", v.
size()));
184 (*this)[index_0] = v[index_0];
185 (*this)[index_1] = v[index_1];
186 (*this)[index_2] = v[index_2];
212 const unsigned int index_0 = 0;
213 const unsigned int index_1 = 1;
214 const unsigned int index_2 = 2;
215 (*this)[index_0] = tx;
216 (*this)[index_1] = ty;
217 (*this)[index_2] = tz;
242 const unsigned int val_3 = 3;
243 for (
unsigned int i = 0; i < val_3; ++i) {
244 s[i] = (*this)[i] + tv[i];
278 const unsigned int val_3 = 3;
279 for (
unsigned int i = 0; i < val_3; ++i) {
280 s[i] = (*this)[i] + v[i];
308 const unsigned int val_3 = 3;
309 for (
unsigned int i = 0; i < val_3; ++i) {
310 sub[i] = (*this)[i] - tv[i];
333 for (
unsigned int i = 0; i <
dsize; ++i) {
359 for (
unsigned int i = 0; i <
dsize; ++i) {
378 unsigned int v_col = v.
getCols();
379 for (
unsigned int i = 0; i <
rowNum; ++i) {
380 for (
unsigned int j = 0; j < v_col; ++j) {
381 M[i][j] = (*this)[i] * v[j];
397 for (
unsigned int i = 0; i <
rowNum; ++i) {
412 for (
unsigned int i = 0; i <
rowNum; ++i) {
437 for (
unsigned int i = 0; i <
dsize; ++i) {
462 if (tv.
size() != 3) {
464 "Cannot initialize a translation vector from a "
465 "%d-dimension col vector",
468 unsigned int k = tv.
size();
497 unsigned int k = tv.
rowNum;
527 for (
int i = 0; i < 3; ++i) {
534 #if (VISP_CXX_STANDARD >= VISP_CXX_STANDARD_11)
558 if (list.size() >
size()) {
561 "Cannot set translation vector out of bounds. It has only %d values while you try to initialize with %d values",
562 size(), list.size()));
564 std::copy(list.begin(), list.end(),
data);
636 "Cannot set translation vector out of bounds. It has only %d values while you try to initialize with %d values",
662 const unsigned int index_0 = 0;
663 const unsigned int index_1 = 1;
664 const unsigned int index_2 = 2;
666 M[index_0][index_0] = 0;
667 M[index_0][index_1] = -tv[index_2];
668 M[index_0][index_2] = tv[index_1];
669 M[index_1][index_0] = tv[index_2];
670 M[index_1][index_1] = 0;
671 M[index_1][index_2] = -tv[index_0];
672 M[index_2][index_0] = -tv[index_1];
673 M[index_2][index_1] = tv[index_0];
674 M[index_2][index_2] = 0;
752 #if defined(VISP_BUILD_DEPRECATED_FUNCTIONS)
764 double vpTranslationVector::euclideanNorm()
const {
return frobeniusNorm(); }
788 double sum_square = 0.0;
790 for (
unsigned int i = 0; i <
rowNum; ++i) {
809 size_t vec_m_size = vec_M.size();
810 for (
size_t i = 0; i < vec_m_size; ++i) {
811 meanT +=
static_cast<vpColVector>(vec_M[i].getTranslationVector());
813 meanT /=
static_cast<double>(vec_M.size());
830 size_t l_vec_t_size = vec_t.size();
831 for (
size_t i = 0; i < l_vec_t_size; ++i) {
834 meanT /=
static_cast<double>(vec_t.size());
Implementation of a generic 2D array used as base class for matrices and vectors.
unsigned int getCols() const
Type * data
Address of the first element of the data array.
double ** rowPtrs
Address of the first element of each rows.
void resize(unsigned int nrows, unsigned int ncols, bool flagNullify=true, bool recopy_=true)
unsigned int rowNum
Number of rows in the array.
unsigned int dsize
Current array size (rowNum * colNum)
unsigned int size() const
Return the number of elements of the 2D array.
Implementation of column vector and the associated operations.
error that can be emitted by ViSP classes.
@ dimensionError
Bad dimension.
Implementation of an homogeneous matrix and operations on such kind of matrices.
void extract(vpRotationMatrix &R) const
Implementation of a matrix and operations on matrices.
Implementation of a pose vector and operations on poses.
Implementation of row vector and the associated operations.
Class that consider the case of a translation vector.
void set(double tx, double ty, double tz)
vpTranslationVector & operator=(const vpColVector &tv)
static vpTranslationVector mean(const std::vector< vpHomogeneousMatrix > &vec_M)
vpTranslationVector & buildFrom(const double &tx, const double &ty, const double &tz)
vpTranslationVector operator/(double x) const
vpTranslationVector & operator/=(double x)
vpTranslationVector & operator*=(double x)
vpMatrix operator*(const vpRowVector &v) const
double frobeniusNorm() const
vpTranslationVector operator-() const
vpTranslationVector operator+(const vpTranslationVector &tv) const
vpTranslationVector & operator<<(double val)
vpTranslationVector & operator,(double val)
static vpTranslationVector cross(const vpTranslationVector &a, const vpTranslationVector &b)
void resize(unsigned int nrows, unsigned int ncols, bool flagNullify=true)