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

Circular dependency between Matrix3 and Quaternion #328

Open
chapulina opened this issue Dec 23, 2021 · 2 comments
Open

Circular dependency between Matrix3 and Quaternion #328

chapulina opened this issue Dec 23, 2021 · 2 comments
Labels
bug Something isn't working

Comments

@chapulina
Copy link
Contributor

Environment

  • OS Version: all
  • Source or binary build? all

Description

While reviewing #324 and #325, I noticed we have a circular dependency between Quaternion and Matrix3. Both classes have a constructor that takes the other:

https://github.com/ignitionrobotics/ign-math/blob/2b0f9a4e8020ae9a0cfcf045176807f114cb6231/include/ignition/math/Matrix3.hh#L86-L88

https://github.com/ignitionrobotics/ign-math/blob/2b0f9a4e8020ae9a0cfcf045176807f114cb6231/include/ignition/math/Quaternion.hh#L87-L90

I don't think this is causing any big issues, but I thought I'd document it on a ticket in case we run into problems in the future. At the very least, it causes 🐔 and 🥚 issues like we're seeing now when creating python bindings: we can't fully create bindings for one class without the other.

If we have to choose one direction to keep, I'd suggest removing Quaternion(const Matrix3<T> &_mat) and instead offering a function like Matrix3::AsQuaternion(), because I think of Quaternions as lower level than Matrix3s.

@chapulina chapulina added the bug Something isn't working label Dec 23, 2021
@chapulina
Copy link
Contributor Author

I don't think this is causing any big issues

One issue we ran into is that we can't forward-declare python interfaces

@azeey
Copy link
Contributor

azeey commented Oct 5, 2023

I'm not sure if this is necessary. It seems like the problem is that the python bindings for Matrix3 and Quaternion were in different PRs. Having the circular dependency forces us to have to implement the bindings at the same time, but I don't think it's problematic enough to remove functionality from either of the classes, i.e, choosing only one direction.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants