47 #include <visp3/core/vpException.h>
48 #include <visp3/core/vpForceTwistMatrix.h>
59 for (
int i = 0; i < 6; ++i) {
60 for (
int j = 0; j < 6; ++j) {
73 const unsigned int nparam = 6;
74 for (
unsigned int i = 0; i < nparam; ++i) {
75 for (
unsigned int j = 0; j < nparam; ++j) {
280 const unsigned int nparam = 6;
281 for (
unsigned int i = 0; i < nparam; ++i) {
282 for (
unsigned int j = 0; j < nparam; ++j) {
284 for (
unsigned int k = 0; k < nparam; ++k) {
302 const unsigned int nparam = 6;
305 "Cannot multiply (6x6) force/torque twist matrix by a (%dx%d) matrix", M.
getRows(), M.
getCols()));
308 unsigned int m_col = M.
getCols();
310 for (
unsigned int i = 0; i < nparam; ++i) {
311 for (
unsigned int j = 0; j < m_col; ++j) {
313 for (
unsigned int k = 0; k < nparam; ++k) {
371 const unsigned int nparam = 6;
376 "Cannot multiply a (6x6) force/torque twist matrix by "
377 "a %d dimension column vector",
383 for (
unsigned int i = 0; i < nparam; ++i) {
384 for (
unsigned int j = 0; j < nparam; ++j) {
385 Hout[i] +=
rowPtrs[i][j] * H[j];
414 const unsigned int val_3 = 3;
415 for (
unsigned int i = 0; i < val_3; ++i) {
416 for (
unsigned int j = 0; j < val_3; ++j) {
417 (*this)[i][j] = R[i][j];
418 (*this)[i + 3][j + 3] = R[i][j];
419 (*this)[i + 3][j] = skewaR[i][j];
443 const unsigned int val_3 = 3;
444 for (
unsigned int i = 0; i < val_3; ++i) {
445 for (
unsigned int j = 0; j < val_3; ++j) {
446 (*this)[i][j] = R[i][j];
447 (*this)[i + 3][j + 3] = R[i][j];
448 (*this)[i + 3][j] = 0;
562 typedef std::string::size_type size_type;
567 std::vector<std::string> values(m * n);
568 std::ostringstream oss;
569 std::ostringstream ossFixed;
570 std::ios_base::fmtflags original_flags = oss.flags();
573 ossFixed.setf(std::ios::fixed, std::ios::floatfield);
575 size_type maxBefore = 0;
576 size_type maxAfter = 0;
578 for (
unsigned int i = 0; i < m; ++i) {
579 for (
unsigned int j = 0; j < n; ++j) {
581 oss << (*this)[i][j];
582 if (oss.str().find(
"e") != std::string::npos) {
584 ossFixed << (*this)[i][j];
585 oss.str(ossFixed.str());
588 values[(i * n) + j] = oss.str();
589 size_type thislen = values[(i * n) + j].
size();
590 size_type p = values[(i * n) + j].find(
'.');
592 if (p == std::string::npos) {
603 size_type totalLength = length;
607 maxAfter = std::min<size_type>(maxAfter, totalLength - maxBefore);
618 s <<
"[" << m <<
"," << n <<
"]=\n";
620 for (
unsigned int i = 0; i < m; ++i) {
622 for (
unsigned int j = 0; j < n; ++j) {
623 size_type p = values[(i * n) + j].find(
'.');
624 s.setf(std::ios::right, std::ios::adjustfield);
625 s.width(
static_cast<std::streamsize
>(maxBefore));
626 s << values[(i * n) + j].substr(0, p).c_str();
629 s.setf(std::ios::left, std::ios::adjustfield);
630 if (p != std::string::npos) {
631 s.width(
static_cast<std::streamsize
>(maxAfter));
632 s << values[(i * n) + j].substr(p, maxAfter).c_str();
635 assert(maxAfter > 1);
636 s.width(
static_cast<std::streamsize
>(maxAfter));
646 s.flags(original_flags);
648 return static_cast<int>(maxBefore + maxAfter);
651 #if defined(VISP_BUILD_DEPRECATED_FUNCTIONS)
659 void vpForceTwistMatrix::setIdentity() {
eye(); }
662 #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 &F) const
vpForceTwistMatrix & operator=(const vpForceTwistMatrix &H)
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.