45 #include <visp3/core/vpException.h> 46 #include <visp3/core/vpMath.h> 47 #include <visp3/core/vpQuaternionVector.h> 56 std::cout <<
"q3=" << q3 << std::endl;
57 if (!
vpMath::equal(q3.
x(), 2.6, std::numeric_limits<double>::epsilon()) ||
58 !
vpMath::equal(q3.
y(), 0.4, std::numeric_limits<double>::epsilon()) ||
59 !
vpMath::equal(q3.
z(), -3.0, std::numeric_limits<double>::epsilon()) ||
60 !
vpMath::equal(q3.
w(), 4.0, std::numeric_limits<double>::epsilon())) {
66 std::cout <<
"q4=" << q4 << std::endl;
67 if (!
vpMath::equal(q4.
x(), q2.x(), std::numeric_limits<double>::epsilon() * 1e4) ||
68 !
vpMath::equal(q4.
y(), q2.y(), std::numeric_limits<double>::epsilon() * 1e4) ||
69 !
vpMath::equal(q4.
z(), q2.z(), std::numeric_limits<double>::epsilon() * 1e4) ||
70 !
vpMath::equal(q4.
w(), q2.w(), std::numeric_limits<double>::epsilon() * 1e4)) {
79 std::cout <<
"q7=" << q7 << std::endl;
80 if (!
vpMath::equal(q7.
x(), 3.0, std::numeric_limits<double>::epsilon() * 1e4) ||
81 !
vpMath::equal(q7.
y(), 36.7, std::numeric_limits<double>::epsilon() * 1e4) ||
82 !
vpMath::equal(q7.
z(), -6.6, std::numeric_limits<double>::epsilon() * 1e4) ||
83 !
vpMath::equal(q7.
w(), 1.3, std::numeric_limits<double>::epsilon() * 1e4)) {
89 std::cout <<
"q7_conj=" << q7_conj << std::endl;
90 if (!
vpMath::equal(q7_conj.
x(), -3.0, std::numeric_limits<double>::epsilon() * 1e4) ||
91 !
vpMath::equal(q7_conj.
y(), -36.7, std::numeric_limits<double>::epsilon() * 1e4) ||
92 !
vpMath::equal(q7_conj.
z(), 6.6, std::numeric_limits<double>::epsilon() * 1e4) ||
93 !
vpMath::equal(q7_conj.
w(), 1.3, std::numeric_limits<double>::epsilon() * 1e4)) {
99 std::cout <<
"q7_inv=" << q7_inv << std::endl;
107 std::cout <<
"q7_norm=" << q7_norm << std::endl;
114 std::cout <<
"q7_unit=" << q7 << std::endl;
122 std::cout <<
"q_copy1=" << q_copy1 << std::endl;
124 q_copy1.
set(1, 0, 1, 10);
125 std::cout <<
"q_copy1 after set=" << q_copy1 << std::endl;
126 std::cout <<
"q_copy2=" << q_copy2 << std::endl;
131 std::cout <<
"q_copy3=" << q_copy3 << std::endl;
133 std::cout <<
"vpQuaternion operations are ok !" << std::endl;
136 std::cerr <<
"Catch an exception: " << e << std::endl;
void set(const double x, const double y, const double z, const double w)
vpQuaternionVector inverse() const
static bool equal(double x, double y, double s=0.001)
error that can be emited by ViSP classes.
double y() const
Returns y-component of the quaternion.
vpQuaternionVector conjugate() const
double w() const
Returns w-component of the quaternion.
double z() const
Returns z-component of the quaternion.
double x() const
Returns x-component of the quaternion.
Implementation of a rotation vector as quaternion angle minimal representation.