diff options
author | 2020-05-23 19:00:02 -0500 | |
---|---|---|
committer | 2020-07-07 20:16:54 +0000 | |
commit | 8889a2c1c648f5dd1413dc2d94c2407c7ce1bd32 (patch) | |
tree | de1f99d138323585ff322a9efb94e0d05eb2f14f /Eigen | |
parent | 6964ae8d52d42d2821572fc8359e56c821289e00 (diff) |
Add operator==/operator!= to Quaternion. Fixes #1876.
Diffstat (limited to 'Eigen')
-rw-r--r-- | Eigen/src/Geometry/Quaternion.h | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/Eigen/src/Geometry/Quaternion.h b/Eigen/src/Geometry/Quaternion.h index 7b2c4d89d..dd1217e5e 100644 --- a/Eigen/src/Geometry/Quaternion.h +++ b/Eigen/src/Geometry/Quaternion.h @@ -158,6 +158,22 @@ class QuaternionBase : public RotationBase<Derived, 3> template<class OtherDerived> EIGEN_DEVICE_FUNC Quaternion<Scalar> slerp(const Scalar& t, const QuaternionBase<OtherDerived>& other) const; + /** \returns true if each coefficients of \c *this and \a other are all exactly equal. + * \warning When using floating point scalar values you probably should rather use a + * fuzzy comparison such as isApprox() + * \sa isApprox(), operator!= */ + template<class OtherDerived> + EIGEN_DEVICE_FUNC inline bool operator==(const QuaternionBase<OtherDerived>& other) const + { return coeffs() == other.coeffs(); } + + /** \returns true if at least one pair of coefficients of \c *this and \a other are not exactly equal to each other. + * \warning When using floating point scalar values you probably should rather use a + * fuzzy comparison such as isApprox() + * \sa isApprox(), operator== */ + template<class OtherDerived> + EIGEN_DEVICE_FUNC inline bool operator!=(const QuaternionBase<OtherDerived>& other) const + { return coeffs() != other.coeffs(); } + /** \returns \c true if \c *this is approximately equal to \a other, within the precision * determined by \a prec. * |