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
Functions for calculating angles between vectors. #13008
Conversation
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 like it. Want to add a changelog entry?
include/deal.II/physics/relations.h
Outdated
Physics::Relations::angle(const Tensor<1, spacedim, Number> &a, | ||
const Tensor<1, spacedim, Number> &b) | ||
{ | ||
Assert(a.norm() > 1.e-12 && b.norm() > 1.e-12, |
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'm not generally a fan of these sorts of comparisons because the vectors may well have physical units -- and in that case, what is small and what is large is all relative. I wouldn't object to a comparison of the form
Assert(a.norm() > 1.e-12 && b.norm() > 1.e-12, | |
Assert(a.norm() > 1.e-12*b.norm() && b.norm() > 1.e-12*a.norm(), |
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.
Looks good to me, apart from the comment already given by @bangerth
/rebuild I've addressed all comments. Could you have another look? |
For future patches, I need to calculate angles between vectors, but found similar functionality already hidden in the library. I thought it would be a good idea to make them available throughout the library.
I thought the
Physics
namespace would be good place for these functions. Since they are short I left the implementation in the header and flagged theminline
. I would like to know what you think of this approach. We can move these functions to more appropriate places if you have better ideas :-)