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]);
202 const double tuy,
const double tuz)
257 const double tuy,
const double tuz)
308 if (v.size() != 12 && v.size() != 16) {
312 for (
unsigned int i = 0; i < 12; i++)
313 this->
data[i] = (
double)v[i];
358 if (v.size() != 12 && v.size() != 16) {
362 for (
unsigned int i = 0; i < 12; i++)
363 this->
data[i] = v[i];
373 for (
int i = 0; i < 4; i++) {
374 for (
int j = 0; j < 4; j++) {
440 (*this) = (*this) * M;
455 "Cannot multiply a (4x4) homogeneous matrix by a " 456 "(%dx1) column vector",
463 for (
unsigned int j = 0; j < 4; j++) {
464 for (
unsigned int i = 0; i < 4; i++) {
494 v1[0] = (*this)[0][0] * v[0] + (*this)[0][1] * v[1] + (*this)[0][2] * v[2] + (*this)[0][3] * v[3];
495 v1[1] = (*this)[1][0] * v[0] + (*this)[1][1] * v[1] + (*this)[1][2] * v[2] + (*this)[1][3] * v[3];
496 v1[2] = (*this)[2][0] * v[0] + (*this)[2][1] * v[1] + (*this)[2][2] * v[2] + (*this)[2][3] * v[3];
497 v1[3] = (*this)[3][0] * v[0] + (*this)[3][1] * v[1] + (*this)[3][2] * v[2] + (*this)[3][3] * v[3];
528 t_out[0] = (*this)[0][0] * t[0] + (*this)[0][1] * t[1] + (*this)[0][2] * t[2] + (*this)[0][3];
529 t_out[1] = (*this)[1][0] * t[0] + (*this)[1][1] * t[1] + (*this)[1][2] * t[2] + (*this)[1][3];
530 t_out[2] = (*this)[2][0] * t[0] + (*this)[2][1] * t[1] + (*this)[2][2] * t[2] + (*this)[2][3];
555 for (
unsigned int i = 0; i < 3; i++)
556 for (
unsigned int j = 0; j < 3; j++)
557 R[i][j] = (*
this)[i][j];
565 t[0] = (*this)[0][3];
566 t[1] = (*this)[1][3];
567 t[2] = (*this)[2][3];
594 for (
unsigned int i = 0; i < 3; i++)
595 for (
unsigned int j = 0; j < 3; j++)
596 (*
this)[i][j] = R[i][j];
616 (*this)[0][3] = t[0];
617 (*this)[1][3] = t[1];
618 (*this)[2][3] = t[2];
671 (*this)[0][1] = (*this)[0][2] = (*this)[0][3] = 0;
672 (*this)[1][0] = (*this)[1][2] = (*this)[1][3] = 0;
673 (*this)[2][0] = (*this)[2][1] = (*this)[2][3] = 0;
674 (*this)[3][0] = (*this)[3][1] = (*this)[3][2] = 0;
745 for (
unsigned int i = 0; i < 4; i++) {
746 for (
unsigned int j = 0; j < 4; j++) {
769 for (
unsigned int i = 0; i < 12; i++)
770 M[i] = (
float)(this->
data[i]);
780 for (
unsigned int i = 0; i < 12; i++)
781 M[i] = this->
data[i];
847 unsigned int nb_rows =
getRows();
849 for (
unsigned int i = 0; i < nb_rows; i++)
850 c[i] = (*
this)[i][j];
868 for (
size_t i = 0; i < vec_M.size(); i++) {
869 R = vec_M[i].getRotationMatrix();
873 meanR /=
static_cast<double>(vec_M.size());
874 meanT /=
static_cast<double>(vec_M.size());
880 double det = sv[0]*sv[1]*sv[2];
887 D[0][0] = D[1][1] = 1.0; D[2][2] = -1;
888 meanR = U * D * V.
t();
898 #if defined(VISP_BUILD_DEPRECATED_FUNCTIONS) 908 #endif //#if defined(VISP_BUILD_DEPRECATED_FUNCTIONS) Implementation of a matrix and operations on matrices.
void set_oZ(const double oZ)
Set the point Z coordinate in the object frame.
Implementation of an homogeneous matrix and operations on such kind of matrices.
vp_deprecated void setIdentity()
error that can be emited by ViSP classes.
vpRotationMatrix t() 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 vase class of matrices and vectors.
unsigned int getCols() const
void set_X(const double X)
Set the point X coordinate in the camera frame.
vpThetaUVector buildFrom(const vpHomogeneousMatrix &M)
double get_W() const
Get the point W coordinate in the camera frame.
vpThetaUVector getThetaUVector() const
void load(std::ifstream &f)
Class that defines what is a point.
bool isARotationMatrix() const
Implementation of a rotation matrix and operations on such kind of matrices.
vpHomogeneousMatrix & operator=(const vpHomogeneousMatrix &M)
void insert(const vpRotationMatrix &R)
unsigned int rowNum
Number of rows in the array.
void set_oW(const double oW)
Set the point W coordinate in the object frame.
void set_Z(const double Z)
Set the point Z coordinate in the camera frame.
vpRotationMatrix getRotationMatrix() const
void set_W(const double W)
Set the point W coordinate in the camera frame.
vpTranslationVector getTranslationVector() const
void set_oX(const double oX)
Set the point X coordinate in the object frame.
void set_Y(const double Y)
Set the point Y coordinate in the camera frame.
void extract(vpRotationMatrix &R) const
Implementation of a rotation vector as quaternion angle minimal representation.
unsigned int getRows() const
void buildFrom(const vpTranslationVector &t, const vpRotationMatrix &R)
double get_Y() const
Get the point Y coordinate in the camera frame.
double get_Z() const
Get the point Z coordinate in the camera frame.
bool isAnHomogeneousMatrix() const
void save(std::ofstream &f) const
vpHomogeneousMatrix operator*(const vpHomogeneousMatrix &M) const
Implementation of column vector and the associated operations.
void set_oY(const double oY)
Set the point Y coordinate in the object frame.
static vpHomogeneousMatrix mean(const std::vector< vpHomogeneousMatrix > &vec_M)
Implementation of a pose vector and operations on poses.
vpHomogeneousMatrix inverse() const
vpColVector getCol(const unsigned int j) const
vpMatrix pseudoInverse(double svThreshold=1e-6) const
vpHomogeneousMatrix & operator*=(const vpHomogeneousMatrix &M)
void convert(std::vector< float > &M)
void print() const
Print the matrix as a pose vector .
double get_X() const
Get the point X coordinate in the camera frame.
Class that consider the case of a translation vector.
Implementation of a rotation vector as axis-angle minimal representation.
double ** rowPtrs
Address of the first element of each rows.