3 #include <Eigen/Geometry> 26 static const Scalar one =
Scalar(1) - dummy_precision<Scalar>();
48 static const Scalar one =
Scalar(1) - epsilon<Scalar>();
78 if (
T(1) + x*x ==
T(1))
101 Scalar scale1 = t *
sin_over_x( ( t * theta) ) / sinOverTheta;
146 typedef double RefScalar;
147 typedef float TestScalar;
153 std::cout << g_seed <<
"\n";
163 cout <<
"double=>float=>double nlerp eigen legacy(snap) legacy(nlerp) rightway gael's criteria\n";
167 for (
int w=0;
w<rep; ++
w)
170 a.coeffs().setRandom();
172 b.coeffs().setRandom();
177 Qd ar(a.cast<RefScalar>());
178 Qd
br(b.cast<RefScalar>());
184 cout << std::scientific;
185 for (
int i=0;
i<iters; ++
i)
190 Qf refc = cr.cast<TestScalar>();
199 err[0] = (cr.coeffs()-refc.cast<RefScalar>().coeffs()).norm();
201 for (
int k=0; k<6; ++k)
203 err[k+1] = (c[k].coeffs()-refc.coeffs()).norm();
206 maxerr = maxerr.cwise().max(err);
209 b = cr.cast<TestScalar>();
214 avgerr /= RefScalar(rep*iters);
215 cout <<
"\n\nAccuracy:\n" 216 <<
" max: " << maxerr.transpose() <<
"\n";
217 cout <<
" avg: " << avgerr.transpose() <<
"\n";
228 #define BENCH(FUNC) {\ 230 for(int k=0; k<2; ++k) {\ 232 for(int i=0; i<1000000; ++i) \ 236 cout << " " << #FUNC << " => \t " << t.value() << "s\n"; \ 239 cout <<
"\nSpeed:\n" << std::fixed;
EIGEN_DEVICE_FUNC Coefficients & coeffs()
EIGEN_DEVICE_FUNC Matrix< _Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols > & setZero(Index size)
Namespace containing all symbols from the Eigen library.
#define EIGEN_DONT_INLINE
EIGEN_DEVICE_FUNC void normalize()
EIGEN_DEVICE_FUNC Scalar dot(const QuaternionBase< OtherDerived > &other) const
EIGEN_DONT_INLINE Q slerp_eigen(const Q &a, const Q &b, typename Q::Scalar t)
Eigen::Triplet< double > T
EIGEN_DONT_INLINE Q slerp_gael(const Q &a, const Q &b, typename Q::Scalar t)
EIGEN_DONT_INLINE Q slerp_legacy_nlerp(const Q &a, const Q &b, typename Q::Scalar t)
EIGEN_DEVICE_FUNC const AcosReturnType acos() const
EIGEN_DONT_INLINE Q slerp_legacy(const Q &a, const Q &b, typename Q::Scalar t)
The quaternion class used to represent 3D orientations and rotations.
EIGEN_DEVICE_FUNC Quaternion< Scalar > slerp(const Scalar &t, const QuaternionBase< OtherDerived > &other) const
EIGEN_DEVICE_FUNC const SinReturnType sin() const
EIGEN_DONT_INLINE Q nlerp(const Q &a, const Q &b, typename Q::Scalar t)
The matrix class, also used for vectors and row-vectors.
set noclip points set clip one set noclip two set bar set border lt lw set xdata set ydata set zdata set x2data set y2data set boxwidth set dummy x
EIGEN_DONT_INLINE Q slerp_rw(const Q &a, const Q &b, typename Q::Scalar t)
EIGEN_DEVICE_FUNC const AsinReturnType asin() const
static unsigned int g_seed