45 #include <visp3/core/vpDebug.h> 46 #include <visp3/core/vpException.h> 47 #include <visp3/core/vpHomogeneousMatrix.h> 48 #include <visp3/core/vpMatrix.h> 49 #include <visp3/core/vpPoint.h> 50 #include <visp3/core/vpQuaternionVector.h> 102 buildFrom(p[0], p[1], p[2], p[3], p[4], p[5]);
306 if (v.size() != 12 && v.size() != 16) {
310 for (
unsigned int i = 0; i < 12; i++)
311 this->
data[i] = (
double)v[i];
356 if (v.size() != 12 && v.size() != 16) {
360 for (
unsigned int i = 0; i < 12; i++)
361 this->
data[i] = v[i];
371 for (
int i = 0; i < 4; i++) {
372 for (
int j = 0; j < 4; j++) {
438 (*this) = (*this) * M;
453 "Cannot multiply a (4x4) homogeneous matrix by a " 454 "(%dx1) column vector",
461 for (
unsigned int j = 0; j < 4; j++) {
462 for (
unsigned int i = 0; i < 4; i++) {
492 v1[0] = (*this)[0][0] * v[0] + (*this)[0][1] * v[1] + (*this)[0][2] * v[2] + (*this)[0][3] * v[3];
493 v1[1] = (*this)[1][0] * v[0] + (*this)[1][1] * v[1] + (*this)[1][2] * v[2] + (*this)[1][3] * v[3];
494 v1[2] = (*this)[2][0] * v[0] + (*this)[2][1] * v[1] + (*this)[2][2] * v[2] + (*this)[2][3] * v[3];
495 v1[3] = (*this)[3][0] * v[0] + (*this)[3][1] * v[1] + (*this)[3][2] * v[2] + (*this)[3][3] * v[3];
526 t_out[0] = (*this)[0][0] * t[0] + (*this)[0][1] * t[1] + (*this)[0][2] * t[2] + (*this)[0][3];
527 t_out[1] = (*this)[1][0] * t[0] + (*this)[1][1] * t[1] + (*this)[1][2] * t[2] + (*this)[1][3];
528 t_out[2] = (*this)[2][0] * t[0] + (*this)[2][1] * t[1] + (*this)[2][2] * t[2] + (*this)[2][3];
553 for (
unsigned int i = 0; i < 3; i++)
554 for (
unsigned int j = 0; j < 3; j++)
555 R[i][j] = (*
this)[i][j];
563 t[0] = (*this)[0][3];
564 t[1] = (*this)[1][3];
565 t[2] = (*this)[2][3];
592 for (
unsigned int i = 0; i < 3; i++)
593 for (
unsigned int j = 0; j < 3; j++)
594 (*
this)[i][j] = R[i][j];
614 (*this)[0][3] = t[0];
615 (*this)[1][3] = t[1];
616 (*this)[2][3] = t[2];
669 (*this)[0][1] = (*this)[0][2] = (*this)[0][3] = 0;
670 (*this)[1][0] = (*this)[1][2] = (*this)[1][3] = 0;
671 (*this)[2][0] = (*this)[2][1] = (*this)[2][3] = 0;
672 (*this)[3][0] = (*this)[3][1] = (*this)[3][2] = 0;
743 for (
unsigned int i = 0; i < 4; i++) {
744 for (
unsigned int j = 0; j < 4; j++) {
767 for (
unsigned int i = 0; i < 12; i++)
768 M[i] = (
float)(this->
data[i]);
778 for (
unsigned int i = 0; i < 12; i++)
779 M[i] = this->
data[i];
845 unsigned int nb_rows =
getRows();
847 for (
unsigned int i = 0; i < nb_rows; i++)
848 c[i] = (*
this)[i][j];
866 for (
size_t i = 0; i < vec_M.size(); i++) {
867 R = vec_M[i].getRotationMatrix();
871 meanR /=
static_cast<double>(vec_M.size());
872 meanT /=
static_cast<double>(vec_M.size());
878 double det = sv[0]*sv[1]*sv[2];
885 D[0][0] = D[1][1] = 1.0; D[2][2] = -1;
886 meanR = U * D * V.
t();
896 #if defined(VISP_BUILD_DEPRECATED_FUNCTIONS) 906 #endif //#if defined(VISP_BUILD_DEPRECATED_FUNCTIONS) Implementation of a matrix and operations on matrices.
vpMatrix pseudoInverse(double svThreshold=1e-6) const
Implementation of an homogeneous matrix and operations on such kind of matrices.
vp_deprecated void setIdentity()
void print() const
Print the matrix as a pose vector .
error that can be emited by ViSP classes.
unsigned int getRows() const
vpHomogeneousMatrix inverse() const
double * data
Address of the first element of the data array.
vpQuaternionVector buildFrom(const double qx, const double qy, const double qz, const double qw)
Implementation of a generic 2D array used as base class for matrices and vectors. ...
void extract(vpRotationMatrix &R) const
void set_Y(double Y)
Set the point Y coordinate in the camera frame.
vpThetaUVector getThetaUVector() const
vpThetaUVector buildFrom(const vpHomogeneousMatrix &M)
vpRotationMatrix t() const
void load(std::ifstream &f)
double get_W() const
Get the point W coordinate in the camera frame.
vpColVector getCol(unsigned int j) const
Class that defines what is a point.
Implementation of a rotation matrix and operations on such kind of matrices.
unsigned int getCols() const
vpHomogeneousMatrix & operator=(const vpHomogeneousMatrix &M)
void insert(const vpRotationMatrix &R)
unsigned int rowNum
Number of rows in the array.
void set_W(double W)
Set the point W coordinate in the camera frame.
void set_oY(double oY)
Set the point Y coordinate in the object frame.
vpHomogeneousMatrix operator*(const vpHomogeneousMatrix &M) const
bool isAnHomogeneousMatrix() const
Implementation of a rotation vector as quaternion angle minimal representation.
void set_oW(double oW)
Set the point W coordinate in the object frame.
void buildFrom(const vpTranslationVector &t, const vpRotationMatrix &R)
void set_oZ(double oZ)
Set the point Z coordinate in the object frame.
vpTranslationVector getTranslationVector() const
double get_X() const
Get the point X coordinate in the camera frame.
void set_Z(double Z)
Set the point Z coordinate in the camera frame.
Implementation of column vector and the associated operations.
void set_oX(double oX)
Set the point X coordinate in the object frame.
static vpHomogeneousMatrix mean(const std::vector< vpHomogeneousMatrix > &vec_M)
Implementation of a pose vector and operations on poses.
void save(std::ofstream &f) const
vpHomogeneousMatrix & operator*=(const vpHomogeneousMatrix &M)
void convert(std::vector< float > &M)
double get_Z() const
Get the point Z coordinate in the camera frame.
double get_Y() const
Get the point Y coordinate in the camera frame.
Class that consider the case of a translation vector.
Implementation of a rotation vector as axis-angle minimal representation.
bool isARotationMatrix() const
double ** rowPtrs
Address of the first element of each rows.
vpRotationMatrix getRotationMatrix() const
void set_X(double X)
Set the point X coordinate in the camera frame.