44 #include <visp3/core/vpException.h>
45 #include <visp3/core/vpMath.h>
46 #include <visp3/core/vpMatrixException.h>
47 #include <visp3/core/vpPoseVector.h>
51 const unsigned int vpPoseVector::constr_value_6 = 6;
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;
191 const unsigned int index_0 = 0;
192 const unsigned int index_1 = 1;
193 const unsigned int index_2 = 2;
194 const unsigned int index_3 = 3;
195 const unsigned int index_4 = 4;
196 const unsigned int index_5 = 5;
197 (*this)[index_0] = tx;
198 (*this)[index_1] = ty;
199 (*this)[index_2] = tz;
201 (*this)[index_3] = tux;
202 (*this)[index_4] = tuy;
203 (*this)[index_5] = tuz;
241 const unsigned int val_3 = 3;
242 const unsigned int index_3 = 3;
243 for (
unsigned int i = 0; i < val_3; ++i) {
245 (*this)[i + index_3] = tu[i];
277 const unsigned int index_0 = 0;
278 const unsigned int index_1 = 1;
279 const unsigned int index_2 = 2;
280 tv[index_0] = (*this)[index_0];
281 tv[index_1] = (*this)[index_1];
282 tv[index_2] = (*this)[index_2];
290 const unsigned int index_0 = 0;
291 const unsigned int index_1 = 1;
292 const unsigned int index_2 = 2;
293 const unsigned int index_3 = 3;
294 const unsigned int index_4 = 4;
295 const unsigned int index_5 = 5;
296 tu[index_0] = (*this)[index_3];
297 tu[index_1] = (*this)[index_4];
298 tu[index_2] = (*this)[index_5];
313 const unsigned int index_3 = 3;
314 const unsigned int index_4 = 4;
315 const unsigned int index_5 = 5;
316 R.
buildFrom((*
this)[index_3], (*
this)[index_4], (*
this)[index_5]);
324 const unsigned int index_0 = 0;
325 const unsigned int index_1 = 1;
326 const unsigned int index_2 = 2;
374 const unsigned int nparam = 6;
375 const unsigned int nparam_t = 3;
376 for (
unsigned int i = 0; i < nparam; ++i) {
378 std::cout << (*this)[i] <<
" ";
384 std::cout << std::endl;
421 const unsigned int nparam = 6;
422 for (
unsigned int i = 0; i < nparam; ++i) {
463 typedef std::string::size_type size_type;
468 std::vector<std::string> values(m * n);
469 std::ostringstream oss;
470 std::ostringstream ossFixed;
471 std::ios_base::fmtflags original_flags = oss.flags();
474 ossFixed.setf(std::ios::fixed, std::ios::floatfield);
476 size_type maxBefore = 0;
477 size_type maxAfter = 0;
479 for (
unsigned int i = 0; i < m; ++i) {
482 if (oss.str().find(
"e") != std::string::npos) {
484 ossFixed << (*this)[i];
485 oss.str(ossFixed.str());
488 values[i] = oss.str();
489 size_type thislen = values[i].size();
490 size_type p = values[i].find(
'.');
492 if (p == std::string::npos) {
502 size_type totalLength = length;
506 maxAfter = std::min<size_type>(maxAfter, totalLength - maxBefore);
517 s <<
"[" << m <<
"," << n <<
"]=\n";
519 for (
unsigned int i = 0; i < m; ++i) {
521 size_type p = values[i].find(
'.');
522 s.setf(std::ios::right, std::ios::adjustfield);
523 s.width(
static_cast<std::streamsize
>(maxBefore));
524 s << values[i].substr(0, p).c_str();
527 s.setf(std::ios::left, std::ios::adjustfield);
528 if (p != std::string::npos) {
529 s.width(
static_cast<std::streamsize
>(maxAfter));
530 s << values[i].substr(p, maxAfter).c_str();
533 assert(maxAfter > 1);
534 s.width(
static_cast<std::streamsize
>(maxAfter));
544 s.flags(original_flags);
546 return static_cast<int>(maxBefore + maxAfter);
555 std::vector<double> v(this->
size());
557 unsigned int this_size = this->
size();
558 for (
unsigned int i = 0; i < this_size; ++i) {
564 #ifdef VISP_HAVE_NLOHMANN_JSON
565 #include <visp3/core/vpJsonParsing.h>
567 void vpPoseVector::convert_to_json(nlohmann::json &j)
const
573 void vpPoseVector::parse_json(
const nlohmann::json &j)
575 #ifdef ENABLE_VISP_NAMESPACE
579 if (j.is_object() && j.contains(
"type")) {
580 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(const double &tx, const double &ty, const double &tz, const double &tux, const double &tuy, const 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.