Skip to content

Commit

Permalink
added to tangent base and evalIsApprox
Browse files Browse the repository at this point in the history
  • Loading branch information
MarshallVielmetti committed Jan 26, 2025
1 parent 2abfc17 commit daf02ba
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
16 changes: 16 additions & 0 deletions include/manif/impl/tangent_base.h
Original file line number Diff line number Diff line change
Expand Up @@ -946,6 +946,22 @@ bool operator ==(
return t.isApprox(v);
}

template <typename _Derived, typename _DerivedOther>
bool operator !=(
const TangentBase<_Derived>& ta,
const TangentBase<_DerivedOther>& tb)
{
return !(ta == tb);
}

template <typename _Derived, typename _EigenDerived>
bool operator !=(
const TangentBase<_Derived>& t,
const Eigen::MatrixBase<_EigenDerived>& v)
{
return !(t == v);
}

// Utils

template <typename _Stream, typename _Derived>
Expand Down
4 changes: 4 additions & 0 deletions test/common_tester.h
Original file line number Diff line number Diff line change
Expand Up @@ -522,26 +522,30 @@ class CommonTester
EXPECT_TRUE(LieGroup::Identity().isApprox(LieGroup::Identity(), tol_));

EXPECT_TRUE(LieGroup::Identity() == LieGroup::Identity());
EXPECT_FALSE(LieGroup::Identity() != LieGroup::Identity());

EXPECT_TRUE(getState().isApprox(getState(), tol_));
EXPECT_FALSE(getState().isApprox(LieGroup::Random(), tol_));

// cppcheck-suppress duplicateExpression
EXPECT_TRUE(getState() == getState());
EXPECT_FALSE(getState() == LieGroup::Random());
EXPECT_TRUE(getState() != LieGroup::Random());

// Tangent

EXPECT_TRUE(Tangent::Zero().isApprox(Tangent::Zero(), tol_));

EXPECT_TRUE(Tangent::Zero() == Tangent::Zero());
EXPECT_FALSE(Tangent::Zero() != Tangent::Zero());

EXPECT_TRUE(getDelta().isApprox(getDelta(), tol_));
EXPECT_FALSE(getDelta().isApprox(Tangent::Random(), tol_));

// cppcheck-suppress duplicateExpression
EXPECT_TRUE(getDelta() == getDelta());
EXPECT_FALSE(getDelta() == Tangent::Random());
EXPECT_TRUE(getDelta() != Tangent::Random());
}

void evalUnaryMinus()
Expand Down

0 comments on commit daf02ba

Please sign in to comment.