Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow Vector3::Equal to use vector of tolerances #42

Open
osrf-migration opened this issue Apr 4, 2016 · 1 comment
Open

Allow Vector3::Equal to use vector of tolerances #42

osrf-migration opened this issue Apr 4, 2016 · 1 comment
Labels
enhancement New feature or request

Comments

@osrf-migration
Copy link

Original report (archived issue) by John Hsu (Bitbucket: hsu, GitHub: hsu).


Curently, the Vector3::Equal with tolerance check uses a single tolerance for all three elements.

Proposal to extend it by adding:

      /// \brief Equality test with tolerance vector.
      /// \param[in] _v the vector to compare to
      /// \param[in] _tol a vector containing equality tolerances.
      /// \return true if the elements of the vectors are equal within
      /// the tolerence specified by _tol.
      public: bool Equal(const Vector3 &_v, const Vector3 &_tol) const
      {
        return equal<T>(this->data[0], _v[0], _tol[0])
            && equal<T>(this->data[1], _v[1], _tol[1])
            && equal<T>(this->data[2], _v[2], _tol[2]);
      }

Based on discussion in pull request #82, we might need to extend it further with:

      public: bool NumericallyEqual(const Vector3 &_v, const Vector3 &_tol) const;
      public: bool RelativelyEqual(const Vector3 &_v, const Vector3 &_tol) const;
@osrf-migration
Copy link
Author

Original comment by Michael Sherman (Bitbucket: sherm1).


I don't think it would be useful to have elementwise tolerance because of the difficulty in supplying meaningful values for them. Having a relative tolerance available makes that largely unnecessary since that produces a different absolute tolerance for each element based on its size.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants