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] <<
" ";
344 std::cout << std::endl;
381 for (
unsigned int i = 0; i < 6; ++i) {
422 typedef std::string::size_type size_type;
427 std::vector<std::string> values(m * n);
428 std::ostringstream oss;
429 std::ostringstream ossFixed;
430 std::ios_base::fmtflags original_flags = oss.flags();
433 ossFixed.setf(std::ios::fixed, std::ios::floatfield);
435 size_type maxBefore = 0;
436 size_type maxAfter = 0;
438 for (
unsigned int i = 0; i < m; ++i) {
441 if (oss.str().find(
"e") != std::string::npos) {
443 ossFixed << (*this)[i];
444 oss.str(ossFixed.str());
447 values[i] = oss.str();
448 size_type thislen = values[i].size();
449 size_type p = values[i].find(
'.');
451 if (p == std::string::npos) {
461 size_type totalLength = length;
465 maxAfter = std::min<size_type>(maxAfter, totalLength - maxBefore);
476 s <<
"[" << m <<
"," << n <<
"]=\n";
478 for (
unsigned int i = 0; i < m; ++i) {
480 size_type p = values[i].find(
'.');
481 s.setf(std::ios::right, std::ios::adjustfield);
482 s.width(
static_cast<std::streamsize
>(maxBefore));
483 s << values[i].substr(0, p).c_str();
486 s.setf(std::ios::left, std::ios::adjustfield);
487 if (p != std::string::npos) {
488 s.width(
static_cast<std::streamsize
>(maxAfter));
489 s << values[i].substr(p, maxAfter).c_str();
492 assert(maxAfter > 1);
493 s.width(
static_cast<std::streamsize
>(maxAfter));
503 s.flags(original_flags);
505 return static_cast<int>(maxBefore + maxAfter);
514 std::vector<double> v(this->
size());
516 unsigned int this_size = this->
size();
517 for (
unsigned int i = 0; i < this_size; ++i) {
523 #ifdef VISP_HAVE_NLOHMANN_JSON
524 #include <visp3/core/vpJsonParsing.h>
526 void vpPoseVector::convert_to_json(nlohmann::json &j)
const
532 void vpPoseVector::parse_json(
const nlohmann::json &j)
535 if (j.is_object() && j.contains(
"type")) {
536 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.