45 #include <visp3/core/vpException.h>
46 #include <visp3/core/vpVelocityTwistMatrix.h>
49 const unsigned int vpVelocityTwistMatrix::constr_val_6 = 6;
59 for (
int i = 0; i < val_6; ++i) {
60 for (
int j = 0; j < val_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) {
142 :
vpArray2D<double>(constr_val_6, constr_val_6)
178 :
vpArray2D<double>(constr_val_6, constr_val_6)
212 :
vpArray2D<double>(constr_val_6, constr_val_6)
228 const unsigned int nparam = 6;
229 for (
unsigned int i = 0; i < nparam; ++i) {
230 for (
unsigned int j = 0; j < nparam; ++j) {
232 for (
unsigned int k = 0; k < nparam; ++k) {
286 const unsigned int nparam = 6;
293 unsigned int m_col = M.
getCols();
294 for (
unsigned int i = 0; i < nparam; ++i) {
295 for (
unsigned int j = 0; j < m_col; ++j) {
297 for (
unsigned int k = 0; k < nparam; ++k) {
319 const unsigned int nparam = 6;
324 "Cannot multiply a (6x6) velocity twist matrix by a "
325 "(%d) column vector",
331 for (
unsigned int i = 0; i < nparam; ++i) {
332 for (
unsigned int j = 0; j < nparam; ++j) {
353 const unsigned int index_3 = 3;
354 const unsigned int val_3 = 3;
355 for (
unsigned int i = 0; i < val_3; ++i) {
356 for (
unsigned int j = 0; j < val_3; ++j) {
357 (*this)[i][j] = R[i][j];
358 (*this)[i + index_3][j + index_3] = R[i][j];
359 (*this)[i][j + index_3] = 0;
383 const unsigned int index_3 = 3;
384 const unsigned int val_3 = 3;
385 for (
unsigned int i = 0; i < val_3; ++i) {
386 for (
unsigned int j = 0; j < val_3; ++j) {
387 (*this)[i][j] = R[i][j];
388 (*this)[i + index_3][j + index_3] = R[i][j];
389 (*this)[i][j + index_3] = skewaR[i][j];
487 const unsigned int val_3 = 3;
488 for (
unsigned int i = 0; i < val_3; ++i) {
489 for (
unsigned int j = 0; j < val_3; ++j) {
490 R[i][j] = (*this)[i][j];
501 const unsigned int val_3 = 3;
502 for (
unsigned int i = 0; i < val_3; ++i) {
503 for (
unsigned int j = 0; j < val_3; ++j) {
504 skTR[i][j] = (*this)[i][j + val_3];
509 const unsigned int index_0 = 0;
510 const unsigned int index_1 = 1;
511 const unsigned int index_2 = 2;
512 tv[index_0] = skT[index_2][index_1];
513 tv[index_1] = skT[index_0][index_2];
514 tv[index_2] = skT[index_1][index_0];
538 typedef std::string::size_type size_type;
543 std::vector<std::string> values(m * n);
544 std::ostringstream oss;
545 std::ostringstream ossFixed;
546 std::ios_base::fmtflags original_flags = oss.flags();
549 ossFixed.setf(std::ios::fixed, std::ios::floatfield);
551 size_type maxBefore = 0;
552 size_type maxAfter = 0;
554 for (
unsigned int i = 0; i < m; ++i) {
555 for (
unsigned int j = 0; j < n; ++j) {
557 oss << (*this)[i][j];
558 if (oss.str().find(
"e") != std::string::npos) {
560 ossFixed << (*this)[i][j];
561 oss.str(ossFixed.str());
564 values[(i * n) + j] = oss.str();
565 size_type thislen = values[(i * n) + j].
size();
566 size_type p = values[(i * n) + j].find(
'.');
568 if (p == std::string::npos) {
579 size_type totalLength = length;
583 maxAfter = std::min<size_type>(maxAfter, totalLength - maxBefore);
594 s <<
"[" << m <<
"," << n <<
"]=\n";
596 for (
unsigned int i = 0; i < m; ++i) {
598 for (
unsigned int j = 0; j < n; ++j) {
599 size_type p = values[(i * n) + j].find(
'.');
600 s.setf(std::ios::right, std::ios::adjustfield);
601 s.width(
static_cast<std::streamsize
>(maxBefore));
602 s << values[(i * n) + j].substr(0, p).c_str();
605 s.setf(std::ios::left, std::ios::adjustfield);
606 if (p != std::string::npos) {
607 s.width(
static_cast<std::streamsize
>(maxAfter));
608 s << values[(i * n) + j].substr(p, maxAfter).c_str();
611 assert(maxAfter > 1);
612 s.width(
static_cast<std::streamsize
>(maxAfter));
622 s.flags(original_flags);
624 return static_cast<int>(maxBefore + maxAfter);
627 #if defined(VISP_BUILD_DEPRECATED_FUNCTIONS)
635 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 & operator=(const vpVelocityTwistMatrix &V)
vpVelocityTwistMatrix & buildFrom(const vpTranslationVector &t, const vpRotationMatrix &R)