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",
127 #ifdef VISP_BUILD_DEPRECATED_FUNCTIONS
221 const unsigned int index_0 = 0;
222 const unsigned int index_1 = 1;
223 const unsigned int index_2 = 2;
224 (*this)[index_0] = p[index_0];
225 (*this)[index_1] = p[index_1];
226 (*this)[index_2] = p[index_2];
241 const unsigned int index_0 = 0;
242 const unsigned int index_1 = 1;
243 const unsigned int index_2 = 2;
244 const unsigned int v_size = 3;
245 if (v.
size() != v_size) {
247 "Cannot build a translation vector from a %d-dimension column vector", v.
size()));
250 (*this)[index_0] = v[index_0];
251 (*this)[index_1] = v[index_1];
252 (*this)[index_2] = v[index_2];
278 const unsigned int index_0 = 0;
279 const unsigned int index_1 = 1;
280 const unsigned int index_2 = 2;
281 (*this)[index_0] = tx;
282 (*this)[index_1] = ty;
283 (*this)[index_2] = tz;
308 const unsigned int val_3 = 3;
309 for (
unsigned int i = 0; i < val_3; ++i) {
310 s[i] = (*this)[i] + tv[i];
344 const unsigned int val_3 = 3;
345 for (
unsigned int i = 0; i < val_3; ++i) {
346 s[i] = (*this)[i] + v[i];
374 const unsigned int val_3 = 3;
375 for (
unsigned int i = 0; i < val_3; ++i) {
376 sub[i] = (*this)[i] - tv[i];
399 for (
unsigned int i = 0; i <
dsize; ++i) {
425 for (
unsigned int i = 0; i <
dsize; ++i) {
444 unsigned int v_col = v.
getCols();
445 for (
unsigned int i = 0; i <
rowNum; ++i) {
446 for (
unsigned int j = 0; j < v_col; ++j) {
447 M[i][j] = (*this)[i] * v[j];
463 for (
unsigned int i = 0; i <
rowNum; ++i) {
478 for (
unsigned int i = 0; i <
rowNum; ++i) {
503 for (
unsigned int i = 0; i <
dsize; ++i) {
528 if (tv.
size() != 3) {
530 "Cannot initialize a translation vector from a "
531 "%d-dimension col vector",
534 unsigned int k = tv.
size();
563 unsigned int k = tv.
rowNum;
593 for (
int i = 0; i < 3; ++i) {
600 #if (VISP_CXX_STANDARD >= VISP_CXX_STANDARD_11)
624 if (list.size() >
size()) {
627 "Cannot set translation vector out of bounds. It has only %d values while you try to initialize with %d values",
628 size(), list.size()));
630 std::copy(list.begin(), list.end(),
data);
702 "Cannot set translation vector out of bounds. It has only %d values while you try to initialize with %d values",
728 const unsigned int index_0 = 0;
729 const unsigned int index_1 = 1;
730 const unsigned int index_2 = 2;
732 M[index_0][index_0] = 0;
733 M[index_0][index_1] = -tv[index_2];
734 M[index_0][index_2] = tv[index_1];
735 M[index_1][index_0] = tv[index_2];
736 M[index_1][index_1] = 0;
737 M[index_1][index_2] = -tv[index_0];
738 M[index_2][index_0] = -tv[index_1];
739 M[index_2][index_1] = tv[index_0];
740 M[index_2][index_2] = 0;
818 #if defined(VISP_BUILD_DEPRECATED_FUNCTIONS)
854 double sum_square = 0.0;
856 for (
unsigned int i = 0; i <
rowNum; ++i) {
875 size_t vec_m_size = vec_M.size();
876 for (
size_t i = 0; i < vec_m_size; ++i) {
877 meanT +=
static_cast<vpColVector>(vec_M[i].getTranslationVector());
879 meanT /=
static_cast<double>(vec_M.size());
896 size_t l_vec_t_size = vec_t.size();
897 for (
size_t i = 0; i < l_vec_t_size; ++i) {
900 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 & build(const double &tx, const double &ty, const double &tz)
vpTranslationVector & operator=(const vpColVector &tv)
static vpTranslationVector mean(const std::vector< vpHomogeneousMatrix > &vec_M)
VP_DEPRECATED double euclideanNorm() const
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)
VP_DEPRECATED vpTranslationVector buildFrom(double tx, double ty, double tz)
void resize(unsigned int nrows, unsigned int ncols, bool flagNullify=true)