9 #include "fwDataTools/config.hpp" 11 #include <fwCore/base.hpp> 13 #include <fwData/Point.hpp> 14 #include <fwData/TransformationMatrix3D.hpp> 16 #include <glm/mat4x4.hpp> 32 FWDATATOOLS_API
static bool invert(const ::fwData::TransformationMatrix3D::csptr& _input,
33 ::fwData::TransformationMatrix3D::sptr& _output);
41 FWDATATOOLS_API
static void multiply(const ::fwData::TransformationMatrix3D::csptr& _trfA,
42 const ::fwData::TransformationMatrix3D::csptr& _trfB,
43 ::fwData::TransformationMatrix3D::sptr& _output);
49 FWDATATOOLS_API
static void identity(::fwData::TransformationMatrix3D::sptr& _trf);
57 FWDATATOOLS_API
static void multiply(const ::fwData::TransformationMatrix3D::csptr& _trf,
58 const ::fwData::Point::csptr& _input, ::fwData::Point::sptr& _output);
65 FWDATATOOLS_API static ::glm::dmat4x4
getMatrixFromTF3D(const ::fwData::TransformationMatrix3D::csptr& _trf);
72 FWDATATOOLS_API
static void setTF3DFromMatrix(::fwData::TransformationMatrix3D::sptr& _trf,
73 const ::glm::dmat4x4& _input);
81 FWDATATOOLS_API
static bool isIdentity(const ::fwData::TransformationMatrix3D::csptr& _trf,
82 const double _epsilon = 1e-12);
91 const auto& coefs = _trf->getCoefficients();
93 ::glm::dmat4x4 mat(coefs[0], coefs[4], coefs[8], coefs[12],
94 coefs[1], coefs[5], coefs[9], coefs[13],
95 coefs[2], coefs[6], coefs[10], coefs[14],
96 coefs[3], coefs[7], coefs[11], coefs[15]);
104 const ::glm::dmat4x4& _input)
108 auto& coefs = _trf->getCoefficients();
109 for (
size_t i = 0; i < 4; ++i)
111 const size_t rowDst = i * 4;
112 const ::glm::length_t rowSrc =
static_cast< ::glm::length_t
>(i);
113 for (
size_t j = 0; j < 4; ++j)
115 const ::glm::length_t colSrc =
static_cast< ::glm::length_t
>(j);
116 coefs[rowDst + j] = _input[colSrc][rowSrc];