45 #include <visp3/core/vpException.h>
46 #include <visp3/core/vpMath.h>
47 #include <visp3/core/vpMatrixException.h>
48 #include <visp3/core/vpPoseVector.h>
82 const unsigned int index_0 = 0;
83 const unsigned int index_1 = 1;
84 const unsigned int index_2 = 2;
85 const unsigned int index_3 = 3;
86 const unsigned int index_4 = 4;
87 const unsigned int index_5 = 5;
88 (*this)[index_0] = tx;
89 (*this)[index_1] = ty;
90 (*this)[index_2] = tz;
92 (*this)[index_3] = tux;
93 (*this)[index_4] = tuy;
94 (*this)[index_5] = tuz;
158 const unsigned int index_0 = 0;
159 const unsigned int index_1 = 1;
160 const unsigned int index_2 = 2;
161 const unsigned int index_3 = 3;
162 const unsigned int index_4 = 4;
163 const unsigned int index_5 = 5;
164 (*this)[index_0] = tx;
165 (*this)[index_1] = ty;
166 (*this)[index_2] = tz;
168 (*this)[index_3] = tux;
169 (*this)[index_4] = tuy;
170 (*this)[index_5] = tuz;
173 #ifdef VISP_BUILD_DEPRECATED_FUNCTIONS
193 build(tx, ty, tz, tux, tuy, tuz);
270 const unsigned int index_0 = 0;
271 const unsigned int index_1 = 1;
272 const unsigned int index_2 = 2;
273 const unsigned int index_3 = 3;
274 const unsigned int index_4 = 4;
275 const unsigned int index_5 = 5;
276 (*this)[index_0] = tx;
277 (*this)[index_1] = ty;
278 (*this)[index_2] = tz;
280 (*this)[index_3] = tux;
281 (*this)[index_4] = tuy;
282 (*this)[index_5] = tuz;
320 const unsigned int val_3 = 3;
321 for (
unsigned int i = 0; i < val_3; ++i) {
323 (*this)[i + 3] = tu[i];
355 const unsigned int index_0 = 0;
356 const unsigned int index_1 = 1;
357 const unsigned int index_2 = 2;
358 tv[index_0] = (*this)[index_0];
359 tv[index_1] = (*this)[index_1];
360 tv[index_2] = (*this)[index_2];
368 const unsigned int index_0 = 0;
369 const unsigned int index_1 = 1;
370 const unsigned int index_2 = 2;
371 const unsigned int index_3 = 3;
372 const unsigned int index_4 = 4;
373 const unsigned int index_5 = 5;
374 tu[index_0] = (*this)[index_3];
375 tu[index_1] = (*this)[index_4];
376 tu[index_2] = (*this)[index_5];
396 const unsigned int index_0 = 0;
397 const unsigned int index_1 = 1;
398 const unsigned int index_2 = 2;
446 const unsigned int nparam = 6;
447 const unsigned int nparam_t = 3;
448 for (
unsigned int i = 0; i < nparam; ++i) {
450 std::cout << (*this)[i] <<
" ";
456 std::cout << std::endl;
493 const unsigned int nparam = 6;
494 for (
unsigned int i = 0; i < nparam; ++i) {
535 typedef std::string::size_type size_type;
540 std::vector<std::string> values(m * n);
541 std::ostringstream oss;
542 std::ostringstream ossFixed;
543 std::ios_base::fmtflags original_flags = oss.flags();
546 ossFixed.setf(std::ios::fixed, std::ios::floatfield);
548 size_type maxBefore = 0;
549 size_type maxAfter = 0;
551 for (
unsigned int i = 0; i < m; ++i) {
554 if (oss.str().find(
"e") != std::string::npos) {
556 ossFixed << (*this)[i];
557 oss.str(ossFixed.str());
560 values[i] = oss.str();
561 size_type thislen = values[i].size();
562 size_type p = values[i].find(
'.');
564 if (p == std::string::npos) {
574 size_type totalLength = length;
578 maxAfter = std::min<size_type>(maxAfter, totalLength - maxBefore);
589 s <<
"[" << m <<
"," << n <<
"]=\n";
591 for (
unsigned int i = 0; i < m; ++i) {
593 size_type p = values[i].find(
'.');
594 s.setf(std::ios::right, std::ios::adjustfield);
595 s.width(
static_cast<std::streamsize
>(maxBefore));
596 s << values[i].substr(0, p).c_str();
599 s.setf(std::ios::left, std::ios::adjustfield);
600 if (p != std::string::npos) {
601 s.width(
static_cast<std::streamsize
>(maxAfter));
602 s << values[i].substr(p, maxAfter).c_str();
605 assert(maxAfter > 1);
606 s.width(
static_cast<std::streamsize
>(maxAfter));
616 s.flags(original_flags);
618 return static_cast<int>(maxBefore + maxAfter);
627 std::vector<double> v(this->
size());
629 unsigned int this_size = this->
size();
630 for (
unsigned int i = 0; i < this_size; ++i) {
636 #ifdef VISP_HAVE_NLOHMANN_JSON
637 #include <visp3/core/vpJsonParsing.h>
639 void vpPoseVector::convert_to_json(nlohmann::json &j)
const
645 void vpPoseVector::parse_json(
const nlohmann::json &j)
647 #ifdef ENABLE_VISP_NAMESPACE
651 if (j.is_object() && j.contains(
"type")) {
652 const bool converted = convertFromTypeAndBuildFrom<vpPoseVector, vpHomogeneousMatrix>(j, *
this);
Implementation of a generic 2D array used as base class for matrices and vectors.
unsigned int getCols() const
Type * data
Address of the first element of the data array.
unsigned int rowNum
Number of rows in the array.
unsigned int size() const
Return the number of elements of the 2D array.
unsigned int getRows() const
error that can be emitted by ViSP classes.
@ badValue
Used to indicate that a value is not in the allowed range.
Implementation of an homogeneous matrix and operations on such kind of matrices.
void extract(vpRotationMatrix &R) const
static Type maximum(const Type &a, const Type &b)
static double deg(double rad)
Implementation of a pose vector and operations on poses.
vpTranslationVector getTranslationVector() const
vpPoseVector & build(const double &tx, const double &ty, const double &tz, const double &tux, const double &tuy, const double &tuz)
std::vector< double > toStdVector() const
void load(std::ifstream &f)
void save(std::ofstream &f) const
friend void from_json(const nlohmann::json &j, vpPoseVector &cam)
friend void to_json(nlohmann::json &j, const vpPoseVector &cam)
void extract(vpRotationMatrix &R) const
void set(double tx, double ty, double tz, double tux, double tuy, double tuz)
vpThetaUVector getThetaUVector() const
static const std::string jsonTypeName
VP_DEPRECATED vpPoseVector buildFrom(double tx, double ty, double tz, double tux, double tuy, double tuz)
vpRotationMatrix getRotationMatrix() const
Implementation of a rotation vector as quaternion angle minimal representation.
vpQuaternionVector & build(const double &qx, const double &qy, const double &qz, const double &qw)
Implementation of a rotation matrix and operations on such kind of matrices.
vpRotationMatrix & build(const vpHomogeneousMatrix &M)
Implementation of row vector and the associated operations.
Implementation of a rotation vector as axis-angle minimal representation.
vpThetaUVector & build(const vpHomogeneousMatrix &M)
Class that consider the case of a translation vector.