46 #include <visp3/core/vpException.h>
47 #include <visp3/core/vpVelocityTwistMatrix.h>
57 for (
int i = 0; i < 6; ++i) {
58 for (
int j = 0; j < 6; ++j) {
71 const unsigned int nparam = 6;
72 for (
unsigned int i = 0; i < nparam; ++i) {
73 for (
unsigned int j = 0; j < nparam; ++j) {
226 const unsigned int nparam = 6;
227 for (
unsigned int i = 0; i < nparam; ++i) {
228 for (
unsigned int j = 0; j < nparam; ++j) {
230 for (
unsigned int k = 0; k < nparam; ++k) {
284 const unsigned int nparam = 6;
291 unsigned int m_col = M.
getCols();
292 for (
unsigned int i = 0; i < nparam; ++i) {
293 for (
unsigned int j = 0; j < m_col; ++j) {
295 for (
unsigned int k = 0; k < nparam; ++k) {
317 const unsigned int nparam = 6;
322 "Cannot multiply a (6x6) velocity twist matrix by a "
323 "(%d) column vector",
329 for (
unsigned int i = 0; i < nparam; ++i) {
330 for (
unsigned int j = 0; j < nparam; ++j) {
351 const unsigned int val_3 = 3;
352 for (
unsigned int i = 0; i < val_3; ++i) {
353 for (
unsigned int j = 0; j < val_3; ++j) {
354 (*this)[i][j] = R[i][j];
355 (*this)[i + 3][j + 3] = R[i][j];
356 (*this)[i][j + 3] = 0;
380 const unsigned int val_3 = 3;
381 for (
unsigned int i = 0; i < val_3; ++i) {
382 for (
unsigned int j = 0; j < val_3; ++j) {
383 (*this)[i][j] = R[i][j];
384 (*this)[i + 3][j + 3] = R[i][j];
385 (*this)[i][j + 3] = skewaR[i][j];
483 const unsigned int val_3 = 3;
484 for (
unsigned int i = 0; i < val_3; ++i) {
485 for (
unsigned int j = 0; j < val_3; ++j) {
486 R[i][j] = (*this)[i][j];
497 const unsigned int val_3 = 3;
498 for (
unsigned int i = 0; i < val_3; ++i) {
499 for (
unsigned int j = 0; j < val_3; ++j) {
500 skTR[i][j] = (*this)[i][j + val_3];
505 const unsigned int index_0 = 0;
506 const unsigned int index_1 = 1;
507 const unsigned int index_2 = 2;
508 tv[index_0] = skT[index_2][index_1];
509 tv[index_1] = skT[index_0][index_2];
510 tv[index_2] = skT[index_1][index_0];
534 typedef std::string::size_type size_type;
539 std::vector<std::string> values(m * n);
540 std::ostringstream oss;
541 std::ostringstream ossFixed;
542 std::ios_base::fmtflags original_flags = oss.flags();
545 ossFixed.setf(std::ios::fixed, std::ios::floatfield);
547 size_type maxBefore = 0;
548 size_type maxAfter = 0;
550 for (
unsigned int i = 0; i < m; ++i) {
551 for (
unsigned int j = 0; j < n; ++j) {
553 oss << (*this)[i][j];
554 if (oss.str().find(
"e") != std::string::npos) {
556 ossFixed << (*this)[i][j];
557 oss.str(ossFixed.str());
560 values[(i * n) + j] = oss.str();
561 size_type thislen = values[(i * n) + j].
size();
562 size_type p = values[(i * n) + j].find(
'.');
564 if (p == std::string::npos) {
575 size_type totalLength = length;
579 maxAfter = std::min<size_type>(maxAfter, totalLength - maxBefore);
590 s <<
"[" << m <<
"," << n <<
"]=\n";
592 for (
unsigned int i = 0; i < m; ++i) {
594 for (
unsigned int j = 0; j < n; ++j) {
595 size_type p = values[(i * n) + j].find(
'.');
596 s.setf(std::ios::right, std::ios::adjustfield);
597 s.width(
static_cast<std::streamsize
>(maxBefore));
598 s << values[(i * n) + j].substr(0, p).c_str();
601 s.setf(std::ios::left, std::ios::adjustfield);
602 if (p != std::string::npos) {
603 s.width(
static_cast<std::streamsize
>(maxAfter));
604 s << values[(i * n) + j].substr(p, maxAfter).c_str();
607 assert(maxAfter > 1);
608 s.width(
static_cast<std::streamsize
>(maxAfter));
618 s.flags(original_flags);
620 return static_cast<int>(maxBefore + maxAfter);
623 #if defined(VISP_BUILD_DEPRECATED_FUNCTIONS)
631 void vpVelocityTwistMatrix::setIdentity() {
eye(); }
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.
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.
vpRotationMatrix t() const
Implementation of a rotation vector as axis-angle minimal representation.
Class that consider the case of a translation vector.
vpVelocityTwistMatrix operator*(const vpVelocityTwistMatrix &V) const
void extract(vpRotationMatrix &R) const
Extract the rotation matrix from the velocity twist matrix.
vpVelocityTwistMatrix inverse() const
Invert the velocity twist matrix.
int print(std::ostream &s, unsigned int length, char const *intro=0) const
vpVelocityTwistMatrix & buildFrom(const vpTranslationVector &t, const vpRotationMatrix &R)
vpVelocityTwistMatrix & operator=(const vpVelocityTwistMatrix &V)