46 #include <visp3/core/vpDebug.h>
47 #include <visp3/core/vpException.h>
48 #include <visp3/core/vpMath.h>
49 #include <visp3/core/vpMatrixException.h>
50 #include <visp3/core/vpPoseVector.h>
223 for (
unsigned int i = 0; i < 3; i++) {
225 (*this)[i + 3] = tu[i];
336 for (
unsigned int i = 0; i < 6; i++)
338 std::cout << (*this)[i] <<
" ";
341 std::cout << std::endl;
378 for (
unsigned int i = 0; i < 6; i++) {
419 typedef std::string::size_type size_type;
424 std::vector<std::string> values(m * n);
425 std::ostringstream oss;
426 std::ostringstream ossFixed;
427 std::ios_base::fmtflags original_flags = oss.flags();
430 ossFixed.setf(std::ios::fixed, std::ios::floatfield);
432 size_type maxBefore = 0;
433 size_type maxAfter = 0;
435 for (
unsigned int i = 0; i < m; ++i) {
438 if (oss.str().find(
"e") != std::string::npos) {
440 ossFixed << (*this)[i];
441 oss.str(ossFixed.str());
444 values[i] = oss.str();
445 size_type thislen = values[i].size();
446 size_type p = values[i].find(
'.');
448 if (p == std::string::npos) {
458 size_type totalLength = length;
462 maxAfter = (std::min)(maxAfter, totalLength - maxBefore);
471 s <<
"[" << m <<
"," << n <<
"]=\n";
473 for (
unsigned int i = 0; i < m; i++) {
475 size_type p = values[i].find(
'.');
476 s.setf(std::ios::right, std::ios::adjustfield);
477 s.width((std::streamsize)maxBefore);
478 s << values[i].substr(0, p).c_str();
481 s.setf(std::ios::left, std::ios::adjustfield);
482 if (p != std::string::npos) {
483 s.width((std::streamsize)maxAfter);
484 s << values[i].substr(p, maxAfter).c_str();
487 assert(maxAfter > 1);
488 s.width((std::streamsize)maxAfter);
498 s.flags(original_flags);
500 return (
int)(maxBefore + maxAfter);
509 std::vector<double> v(this->
size());
511 for (
unsigned int i = 0; i < this->
size(); i++)
516 #ifdef VISP_HAVE_NLOHMANN_JSON
517 #include <visp3/core/vpJsonParsing.h>
519 void vpPoseVector::convert_to_json(nlohmann::json &j)
const
525 void vpPoseVector::parse_json(
const nlohmann::json &j)
528 if (j.is_object() && j.contains(
"type")) {
529 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
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
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 buildFrom(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 buildFrom(const vpHomogeneousMatrix &M)
Implementation of row vector and the associated operations.
Implementation of a rotation vector as axis-angle minimal representation.
vpThetaUVector buildFrom(const vpHomogeneousMatrix &M)
Class that consider the case of a translation vector.