42#include <visp3/core/vpException.h>
43#include <visp3/core/vpMath.h>
44#include <visp3/core/vpQuaternionVector.h>
53 std::cout <<
"q3=" << q3 << std::endl;
54 if (!
vpMath::equal(q3.
x(), 2.6, std::numeric_limits<double>::epsilon()) ||
55 !
vpMath::equal(q3.
y(), 0.4, std::numeric_limits<double>::epsilon()) ||
56 !
vpMath::equal(q3.
z(), -3.0, std::numeric_limits<double>::epsilon()) ||
57 !
vpMath::equal(q3.
w(), 4.0, std::numeric_limits<double>::epsilon())) {
63 std::cout <<
"q4=" << q4 << std::endl;
64 if (!
vpMath::equal(q4.
x(), q2.x(), std::numeric_limits<double>::epsilon() * 1e4) ||
65 !
vpMath::equal(q4.
y(), q2.y(), std::numeric_limits<double>::epsilon() * 1e4) ||
66 !
vpMath::equal(q4.
z(), q2.z(), std::numeric_limits<double>::epsilon() * 1e4) ||
67 !
vpMath::equal(q4.
w(), q2.w(), std::numeric_limits<double>::epsilon() * 1e4)) {
76 std::cout <<
"q7=" << q7 << std::endl;
77 if (!
vpMath::equal(q7.
x(), 3.0, std::numeric_limits<double>::epsilon() * 1e4) ||
78 !
vpMath::equal(q7.
y(), 36.7, std::numeric_limits<double>::epsilon() * 1e4) ||
79 !
vpMath::equal(q7.
z(), -6.6, std::numeric_limits<double>::epsilon() * 1e4) ||
80 !
vpMath::equal(q7.
w(), 1.3, std::numeric_limits<double>::epsilon() * 1e4)) {
86 std::cout <<
"q7_conj=" << q7_conj << std::endl;
87 if (!
vpMath::equal(q7_conj.
x(), -3.0, std::numeric_limits<double>::epsilon() * 1e4) ||
88 !
vpMath::equal(q7_conj.
y(), -36.7, std::numeric_limits<double>::epsilon() * 1e4) ||
89 !
vpMath::equal(q7_conj.
z(), 6.6, std::numeric_limits<double>::epsilon() * 1e4) ||
90 !
vpMath::equal(q7_conj.
w(), 1.3, std::numeric_limits<double>::epsilon() * 1e4)) {
96 std::cout <<
"q7_inv=" << q7_inv << std::endl;
104 std::cout <<
"q7_norm=" << q7_norm << std::endl;
111 std::cout <<
"q7_unit=" << q7 << std::endl;
119 std::cout <<
"q_copy1=" << q_copy1 << std::endl;
121 q_copy1.
set(1, 0, 1, 10);
122 std::cout <<
"q_copy1 after set=" << q_copy1 << std::endl;
123 std::cout <<
"q_copy2=" << q_copy2 << std::endl;
128 std::cout <<
"q_copy3=" << q_copy3 << std::endl;
130 std::cout <<
"vpQuaternion operations are ok !" << std::endl;
134 std::cerr <<
"Catch an exception: " << e << std::endl;
error that can be emitted by ViSP classes.
static bool equal(double x, double y, double threshold=0.001)
Implementation of a rotation vector as quaternion angle minimal representation.
const double & z() const
Returns the z-component of the quaternion.
vpQuaternionVector conjugate() const
vpQuaternionVector inverse() const
void set(double x, double y, double z, double w)
const double & x() const
Returns the x-component of the quaternion.
const double & y() const
Returns the y-component of the quaternion.
const double & w() const
Returns the w-component of the quaternion.