-
Notifications
You must be signed in to change notification settings - Fork 613
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
[wpimath] Make geometry classes constexpr #7222
[wpimath] Make geometry classes constexpr #7222
Conversation
1cd0310
to
52e13b7
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't the Rotation3d(const Eigen::Vector3d&, const Eigen::Vector3d&)
constructor be marked constexpr?
That constructor can't be constexpr because it uses Eigen's QR decomposition, which isn't constexpr. We use that to compute an orthogonal vector when the two input vectors are antiparallel. I'd prefer a cheaper method. Now that I think about it, we could probably pick any other non-antiparallel vector and do the cross product with that instead. |
65c4328
to
0be227b
Compare
I'll see if I can make Pose3d::Exp() and Pose3d::Log() constexpr as well. |
00bab7c
to
c410496
Compare
I'm not happy with the amount of code duplication in Rotation3d and Pose3d for the constexpr and non-constexpr paths. Idk what we can do about it tho other than patching Eigen to make everything constexpr. I have an Eigen branch for that, but it's annoying to keep up to date because it touches a lot of files (336 out of 746 files, 10k LOC of changes). |
969b112
to
e353886
Compare
e353886
to
b9e2c2b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just realized that ct_matrix
will use Eigen if the call is not constant evaluated- Should we just write everything to always use ct_matrix
? The downside is overhead from copying the Eigen matrices in the ct_matrix
constructor.
I want to avoid runtime overhead whenever possible. |
Co-authored-by: Joseph Eng <91924258+KangarooKoala@users.noreply.github.com>
No description provided.