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]);
151 #if (VISP_CXX_STANDARD >= VISP_CXX_STANDARD_11) 192 if (list.size() == 12) {
193 std::copy(list.begin(), list.end(),
data);
199 else if (list.size() == 16) {
200 std::copy(list.begin(), list.end(),
data);
201 for (
size_t i = 12; i < 15; i++) {
202 if (std::fabs(
data[i]) > std::numeric_limits<double>::epsilon()) {
204 "List element %d (%f) should be 0.", i,
data[i]));
207 if (std::fabs(
data[15] - 1.) > std::numeric_limits<double>::epsilon()) {
209 "List element 15 (%f) should be 1.",
data[15]));
377 if (v.size() != 12 && v.size() != 16) {
381 for (
unsigned int i = 0; i < 12; i++)
382 this->
data[i] = (
double)v[i];
427 if (v.size() != 12 && v.size() != 16) {
431 for (
unsigned int i = 0; i < 12; i++)
432 this->
data[i] = v[i];
442 for (
int i = 0; i < 4; i++) {
443 for (
int j = 0; j < 4; j++) {
509 (*this) = (*this) * M;
524 "Cannot multiply a (4x4) homogeneous matrix by a " 525 "(%dx1) column vector",
532 for (
unsigned int j = 0; j < 4; j++) {
533 for (
unsigned int i = 0; i < 4; i++) {
563 v1[0] = (*this)[0][0] * v[0] + (*this)[0][1] * v[1] + (*this)[0][2] * v[2] + (*this)[0][3] * v[3];
564 v1[1] = (*this)[1][0] * v[0] + (*this)[1][1] * v[1] + (*this)[1][2] * v[2] + (*this)[1][3] * v[3];
565 v1[2] = (*this)[2][0] * v[0] + (*this)[2][1] * v[1] + (*this)[2][2] * v[2] + (*this)[2][3] * v[3];
566 v1[3] = (*this)[3][0] * v[0] + (*this)[3][1] * v[1] + (*this)[3][2] * v[2] + (*this)[3][3] * v[3];
597 t_out[0] = (*this)[0][0] * t[0] + (*this)[0][1] * t[1] + (*this)[0][2] * t[2] + (*this)[0][3];
598 t_out[1] = (*this)[1][0] * t[0] + (*this)[1][1] * t[1] + (*this)[1][2] * t[2] + (*this)[1][3];
599 t_out[2] = (*this)[2][0] * t[0] + (*this)[2][1] * t[1] + (*this)[2][2] * t[2] + (*this)[2][3];
725 for (
unsigned int i = 0; i < 3; i++)
726 for (
unsigned int j = 0; j < 3; j++)
727 R[i][j] = (*
this)[i][j];
735 t[0] = (*this)[0][3];
736 t[1] = (*this)[1][3];
737 t[2] = (*this)[2][3];
764 for (
unsigned int i = 0; i < 3; i++)
765 for (
unsigned int j = 0; j < 3; j++)
766 (*
this)[i][j] = R[i][j];
786 (*this)[0][3] = t[0];
787 (*this)[1][3] = t[1];
788 (*this)[2][3] = t[2];
841 (*this)[0][1] = (*this)[0][2] = (*this)[0][3] = 0;
842 (*this)[1][0] = (*this)[1][2] = (*this)[1][3] = 0;
843 (*this)[2][0] = (*this)[2][1] = (*this)[2][3] = 0;
844 (*this)[3][0] = (*this)[3][1] = (*this)[3][2] = 0;
915 for (
unsigned int i = 0; i < 4; i++) {
916 for (
unsigned int j = 0; j < 4; j++) {
939 for (
unsigned int i = 0; i < 12; i++)
940 M[i] = (
float)(this->
data[i]);
950 for (
unsigned int i = 0; i < 12; i++)
951 M[i] = this->
data[i];
1017 unsigned int nb_rows =
getRows();
1019 for (
unsigned int i = 0; i < nb_rows; i++)
1020 c[i] = (*
this)[i][j];
1038 for (
size_t i = 0; i < vec_M.size(); i++) {
1039 R = vec_M[i].getRotationMatrix();
1043 meanR /=
static_cast<double>(vec_M.size());
1044 meanT /=
static_cast<double>(vec_M.size());
1050 double det = sv[0]*sv[1]*sv[2];
1057 D[0][0] = D[1][1] = 1.0; D[2][2] = -1;
1058 meanR = U * D * V.
t();
1068 #if defined(VISP_BUILD_DEPRECATED_FUNCTIONS) 1078 #endif //#if defined(VISP_BUILD_DEPRECATED_FUNCTIONS) Implementation of a matrix and operations on matrices.
void set_W(double cW)
Set the point cW coordinate in the camera frame.
vpHomogeneousMatrix & operator<<(double val)
Implementation of an homogeneous matrix and operations on such kind of matrices.
vp_deprecated void setIdentity()
error that can be emited by ViSP classes.
void set_Z(double cZ)
Set the point cZ coordinate in the camera frame.
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 base class for matrices and vectors. ...
unsigned int size() const
Return the number of elements of the 2D array.
unsigned int getCols() const
vpThetaUVector buildFrom(const vpHomogeneousMatrix &M)
double get_W() const
Get the point cW coordinate in the camera frame.
vpThetaUVector getThetaUVector() const
void load(std::ifstream &f)
Class that defines a 3D point in the object frame and allows forward projection of a 3D point in the ...
bool isARotationMatrix() const
Implementation of a rotation matrix and operations on such kind of matrices.
void set_X(double cX)
Set the point cX coordinate in the camera frame.
vpHomogeneousMatrix & operator=(const vpHomogeneousMatrix &M)
void insert(const vpRotationMatrix &R)
unsigned int rowNum
Number of rows in the array.
void set_oY(double oY)
Set the point oY coordinate in the object frame.
vpRotationMatrix getRotationMatrix() const
vpTranslationVector getTranslationVector() const
void extract(vpRotationMatrix &R) const
Implementation of a rotation vector as quaternion angle minimal representation.
unsigned int getRows() const
void set_oW(double oW)
Set the point oW coordinate in the object frame.
void buildFrom(const vpTranslationVector &t, const vpRotationMatrix &R)
double get_Y() const
Get the point cY coordinate in the camera frame.
double get_Z() const
Get the point cZ coordinate in the camera frame.
bool isAnHomogeneousMatrix() const
void save(std::ofstream &f) const
void set_oZ(double oZ)
Set the point oZ coordinate in the object frame.
vpHomogeneousMatrix operator*(const vpHomogeneousMatrix &M) const
void set_Y(double cY)
Set the point cY coordinate in the camera frame.
Implementation of column vector and the associated operations.
void set_oX(double oX)
Set the point oX coordinate in the object frame.
vpHomogeneousMatrix & operator,(double val)
static vpHomogeneousMatrix mean(const std::vector< vpHomogeneousMatrix > &vec_M)
Implementation of a pose vector and operations on poses.
vpHomogeneousMatrix inverse() const
vpColVector getCol(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 cX 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.