46 #include <visp3/core/vpException.h>
47 #include <visp3/core/vpForceTwistMatrix.h>
51 const unsigned int vpForceTwistMatrix::constr_value_6 = 6;
61 for (
int i = 0; i < val_6; ++i) {
62 for (
int j = 0; j < val_6; ++j) {
75 const unsigned int nparam = 6;
76 for (
unsigned int i = 0; i < nparam; ++i) {
77 for (
unsigned int j = 0; j < nparam; ++j) {
161 :
vpArray2D<double>(constr_value_6, constr_value_6)
205 :
vpArray2D<double>(constr_value_6, constr_value_6)
250 :
vpArray2D<double>(constr_value_6, constr_value_6)
282 const unsigned int nparam = 6;
283 for (
unsigned int i = 0; i < nparam; ++i) {
284 for (
unsigned int j = 0; j < nparam; ++j) {
286 for (
unsigned int k = 0; k < nparam; ++k) {
304 const unsigned int nparam = 6;
307 "Cannot multiply (6x6) force/torque twist matrix by a (%dx%d) matrix", M.
getRows(), M.
getCols()));
310 unsigned int m_col = M.
getCols();
312 for (
unsigned int i = 0; i < nparam; ++i) {
313 for (
unsigned int j = 0; j < m_col; ++j) {
315 for (
unsigned int k = 0; k < nparam; ++k) {
373 const unsigned int val_6 = 6;
374 const unsigned int nparam = 6;
379 "Cannot multiply a (6x6) force/torque twist matrix by "
380 "a %d dimension column vector",
386 for (
unsigned int i = 0; i < nparam; ++i) {
387 for (
unsigned int j = 0; j < nparam; ++j) {
388 Hout[i] +=
rowPtrs[i][j] * H[j];
417 const unsigned int val_3 = 3;
418 const unsigned int index_3 = 3;
419 for (
unsigned int i = 0; i < val_3; ++i) {
420 for (
unsigned int j = 0; j < val_3; ++j) {
421 (*this)[i][j] = R[i][j];
422 (*this)[i + index_3][j + index_3] = R[i][j];
423 (*this)[i + index_3][j] = skewaR[i][j];
447 const unsigned int index_3 = 3;
448 const unsigned int val_3 = 3;
449 for (
unsigned int i = 0; i < val_3; ++i) {
450 for (
unsigned int j = 0; j < val_3; ++j) {
451 (*this)[i][j] = R[i][j];
452 (*this)[i + index_3][j + index_3] = R[i][j];
453 (*this)[i + index_3][j] = 0;
567 typedef std::string::size_type size_type;
572 std::vector<std::string> values(m * n);
573 std::ostringstream oss;
574 std::ostringstream ossFixed;
575 std::ios_base::fmtflags original_flags = oss.flags();
578 ossFixed.setf(std::ios::fixed, std::ios::floatfield);
580 size_type maxBefore = 0;
581 size_type maxAfter = 0;
583 for (
unsigned int i = 0; i < m; ++i) {
584 for (
unsigned int j = 0; j < n; ++j) {
586 oss << (*this)[i][j];
587 if (oss.str().find(
"e") != std::string::npos) {
589 ossFixed << (*this)[i][j];
590 oss.str(ossFixed.str());
593 values[(i * n) + j] = oss.str();
594 size_type thislen = values[(i * n) + j].
size();
595 size_type p = values[(i * n) + j].find(
'.');
597 if (p == std::string::npos) {
608 size_type totalLength = length;
612 maxAfter = std::min<size_type>(maxAfter, totalLength - maxBefore);
623 s <<
"[" << m <<
"," << n <<
"]=\n";
625 for (
unsigned int i = 0; i < m; ++i) {
627 for (
unsigned int j = 0; j < n; ++j) {
628 size_type p = values[(i * n) + j].find(
'.');
629 s.setf(std::ios::right, std::ios::adjustfield);
630 s.width(
static_cast<std::streamsize
>(maxBefore));
631 s << values[(i * n) + j].substr(0, p).c_str();
634 s.setf(std::ios::left, std::ios::adjustfield);
635 if (p != std::string::npos) {
636 s.width(
static_cast<std::streamsize
>(maxAfter));
637 s << values[(i * n) + j].substr(p, maxAfter).c_str();
640 assert(maxAfter > 1);
641 s.width(
static_cast<std::streamsize
>(maxAfter));
651 s.flags(original_flags);
653 return static_cast<int>(maxBefore + maxAfter);
656 #if defined(VISP_BUILD_DEPRECATED_FUNCTIONS)
664 void vpForceTwistMatrix::setIdentity() {
eye(); }
667 #ifdef ENABLE_VISP_NAMESPACE
Implementation of a generic 2D array used as base class for matrices and vectors.
unsigned int getCols() const
double ** rowPtrs
Address of the first element of each rows.
unsigned int size() const
Return the number of elements of the 2D array.
vpArray2D< double > t() const
Compute the transpose of the array.
unsigned int getRows() const
Implementation of column vector and the associated operations.
error that can be emitted by ViSP classes.
@ dimensionError
Bad dimension.
vpForceTwistMatrix & buildFrom(const vpTranslationVector &t, const vpRotationMatrix &R)
vpForceTwistMatrix & operator=(const vpForceTwistMatrix &H)
vpForceTwistMatrix operator*(const vpForceTwistMatrix &F) const
int print(std::ostream &s, unsigned int length, char const *intro=nullptr) const
Implementation of an homogeneous matrix and operations on such kind of matrices.
vpRotationMatrix getRotationMatrix() const
vpTranslationVector getTranslationVector() const
static Type maximum(const Type &a, const Type &b)
Implementation of a matrix and operations on matrices.
Implementation of a rotation matrix and operations on such kind of matrices.
Implementation of a rotation vector as axis-angle minimal representation.
Class that consider the case of a translation vector.