46 #include <visp3/core/vpMath.h>
47 #include <visp3/core/vpQuaternionVector.h>
48 #include <visp3/core/vpException.h>
58 std::cout <<
"q3=" << q3 << std::endl;
59 if(!
vpMath::equal(q3.
x(), 2.6, std::numeric_limits<double>::epsilon()) ||
60 !
vpMath::equal(q3.
y(), 0.4, std::numeric_limits<double>::epsilon()) ||
61 !
vpMath::equal(q3.
z(), -3.0, std::numeric_limits<double>::epsilon()) ||
62 !
vpMath::equal(q3.
w(), 4.0, std::numeric_limits<double>::epsilon())) {
69 std::cout <<
"q4=" << q4 << std::endl;
70 if(!
vpMath::equal(q4.
x(), q2.x(), std::numeric_limits<double>::epsilon()*1e4) ||
71 !
vpMath::equal(q4.
y(), q2.y(), std::numeric_limits<double>::epsilon()*1e4) ||
72 !
vpMath::equal(q4.
z(), q2.z(), std::numeric_limits<double>::epsilon()*1e4) ||
73 !
vpMath::equal(q4.
w(), q2.w(), std::numeric_limits<double>::epsilon()*1e4)) {
83 std::cout <<
"q7=" << q7 << std::endl;
84 if(!
vpMath::equal(q7.
x(), 3.0, std::numeric_limits<double>::epsilon()*1e4) ||
85 !
vpMath::equal(q7.
y(), 36.7, std::numeric_limits<double>::epsilon()*1e4) ||
86 !
vpMath::equal(q7.
z(), -6.6, std::numeric_limits<double>::epsilon()*1e4) ||
87 !
vpMath::equal(q7.
w(), 1.3, std::numeric_limits<double>::epsilon()*1e4)) {
94 std::cout <<
"q7_conj=" << q7_conj << std::endl;
95 if(!
vpMath::equal(q7_conj.
x(), -3.0, std::numeric_limits<double>::epsilon()*1e4) ||
96 !
vpMath::equal(q7_conj.
y(), -36.7, std::numeric_limits<double>::epsilon()*1e4) ||
97 !
vpMath::equal(q7_conj.
z(), 6.6, std::numeric_limits<double>::epsilon()*1e4) ||
98 !
vpMath::equal(q7_conj.
w(), 1.3, std::numeric_limits<double>::epsilon()*1e4)) {
105 std::cout <<
"q7_inv=" << q7_inv << std::endl;
116 std::cout <<
"q7_norm=" << q7_norm << std::endl;
124 std::cout <<
"q7_unit=" << q7 << std::endl;
135 std::cout <<
"q_copy1=" << q_copy1 << std::endl;
137 q_copy1.
set(1, 0, 1, 10);
138 std::cout <<
"q_copy1 after set=" << q_copy1 << std::endl;
139 std::cout <<
"q_copy2=" << q_copy2 << std::endl;
145 std::cout <<
"q_copy3=" << q_copy3 << std::endl;
148 std::cout <<
"vpQuaternion operations are ok !" << std::endl;
152 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.