42#include <visp3/core/vpTranslationVector.h>
45const unsigned int vpTranslationVector::constr_val_3 = 3;
56 const unsigned int index_0 = 0;
57 const unsigned int index_1 = 1;
58 const unsigned int index_2 = 2;
59 (*this)[index_0] = tx;
60 (*this)[index_1] = ty;
61 (*this)[index_2] = tz;
85 const unsigned int index_0 = 0;
86 const unsigned int index_1 = 1;
87 const unsigned int index_2 = 2;
88 (*this)[index_0] = p[index_0];
89 (*this)[index_1] = p[index_1];
90 (*this)[index_2] = p[index_2];
121 const unsigned int val_3 = 3;
122 if (v.size() != val_3) {
123 throw(vpException(vpException::dimensionError,
124 "Cannot construct a translation vector from a "
125 "%d-dimension column vector",
158 const unsigned int index_0 = 0;
159 const unsigned int index_1 = 1;
160 const unsigned int index_2 = 2;
161 (*this)[index_0] = p[index_0];
162 (*this)[index_1] = p[index_1];
163 (*this)[index_2] = p[index_2];
178 const unsigned int index_0 = 0;
179 const unsigned int index_1 = 1;
180 const unsigned int index_2 = 2;
181 const unsigned int v_size = 3;
182 if (v.size() != v_size) {
184 "Cannot build a translation vector from a %d-dimension column vector", v.size()));
187 (*this)[index_0] = v[index_0];
188 (*this)[index_1] = v[index_1];
189 (*this)[index_2] = v[index_2];
219 const unsigned int index_0 = 0;
220 const unsigned int index_1 = 1;
221 const unsigned int index_2 = 2;
222 (*this)[index_0] = tx;
223 (*this)[index_1] = ty;
224 (*this)[index_2] = tz;
249 const unsigned int val_3 = 3;
250 for (
unsigned int i = 0; i < val_3; ++i) {
251 s[i] = (*this)[i] + tv[i];
279 const unsigned int val_3 = 3;
280 if (v.size() != val_3) {
286 for (
unsigned int i = 0; i < val_3; ++i) {
287 s[i] = (*this)[i] + v[i];
315 const unsigned int val_3 = 3;
316 for (
unsigned int i = 0; i < val_3; ++i) {
317 sub[i] = (*this)[i] - tv[i];
340 for (
unsigned int i = 0; i <
dsize; ++i) {
366 for (
unsigned int i = 0; i <
dsize; ++i) {
385 unsigned int v_col = v.getCols();
386 for (
unsigned int i = 0; i <
rowNum; ++i) {
387 for (
unsigned int j = 0; j < v_col; ++j) {
388 M[i][j] = (*this)[i] * v[j];
404 for (
unsigned int i = 0; i <
rowNum; ++i) {
419 for (
unsigned int i = 0; i <
rowNum; ++i) {
444 for (
unsigned int i = 0; i <
dsize; ++i) {
469 const unsigned int val_3 = 3;
470 if (tv.
size() != val_3) {
472 "Cannot initialize a translation vector from a "
473 "%d-dimension col vector",
476 unsigned int k = tv.
size();
505 unsigned int k = tv.
rowNum;
536 for (
int i = 0; i < val_3; ++i) {
543#if (VISP_CXX_STANDARD >= VISP_CXX_STANDARD_11)
567 if (list.size() >
size()) {
570 "Cannot set translation vector out of bounds. It has only %d values while you try to initialize with %d values",
571 size(), list.size()));
573 std::copy(list.begin(), list.end(),
data);
645 "Cannot set translation vector out of bounds. It has only %d values while you try to initialize with %d values",
671 const unsigned int index_0 = 0;
672 const unsigned int index_1 = 1;
673 const unsigned int index_2 = 2;
674 const unsigned int val_3 = 3;
676 M[index_0][index_0] = 0;
677 M[index_0][index_1] = -tv[index_2];
678 M[index_0][index_2] = tv[index_1];
679 M[index_1][index_0] = tv[index_2];
680 M[index_1][index_1] = 0;
681 M[index_1][index_2] = -tv[index_0];
682 M[index_2][index_0] = -tv[index_1];
683 M[index_2][index_1] = tv[index_0];
684 M[index_2][index_2] = 0;
759 memcpy(v.data,
data,
rowNum *
sizeof(
double));
763#if defined(VISP_BUILD_DEPRECATED_FUNCTIONS)
799 double sum_square = 0.0;
801 for (
unsigned int i = 0; i <
rowNum; ++i) {
820 size_t vec_m_size = vec_M.size();
821 for (
size_t i = 0; i < vec_m_size; ++i) {
822 meanT +=
static_cast<vpColVector>(vec_M[i].getTranslationVector());
824 meanT /=
static_cast<double>(vec_M.size());
841 size_t l_vec_t_size = vec_t.size();
842 for (
size_t i = 0; i < l_vec_t_size; ++i) {
845 meanT /=
static_cast<double>(vec_t.size());
Type * data
Address of the first element of the data array.
void resize(unsigned int nrows, unsigned int ncols, bool flagNullify=true, bool recopy_=true)
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.
void set(double tx, double ty, double tz)
vpTranslationVector & operator=(const vpColVector &tv)
static vpTranslationVector mean(const std::vector< vpHomogeneousMatrix > &vec_M)
VP_DEPRECATED double euclideanNorm() const
vpTranslationVector & buildFrom(const double &tx, const double &ty, const double &tz)
vpTranslationVector operator/(double x) const
VP_NORETURN void resize(unsigned int nrows, unsigned int ncols, bool flagNullify=true)
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)