Functions | |
template<int spacedim, typename Number> | |
Number | angle (const Tensor< 1, spacedim, Number > &a, const Tensor< 1, spacedim, Number > &b) |
template<int spacedim, typename Number> | |
Number | signed_angle (const Tensor< 1, spacedim, Number > &a, const Tensor< 1, spacedim, Number > &b, const Tensor< 1, spacedim, Number > &axis) |
Functions to compute relations between spatial vectors.
Number Physics::VectorRelations::angle | ( | const Tensor< 1, spacedim, Number > & | a, |
const Tensor< 1, spacedim, Number > & | b ) |
Calculate the angle a
and b
. The returned angle will be in the range
This function uses the geometric definition of the scalar product.
Number Physics::VectorRelations::signed_angle | ( | const Tensor< 1, spacedim, Number > & | a, |
const Tensor< 1, spacedim, Number > & | b, | ||
const Tensor< 1, spacedim, Number > & | axis ) |
Calculate the angle a
and b
, where both vectors are located in a plane described by a normal vector axis
.
The angle computed by this function corresponds to the rotation angle that would transform the vector a
into the vector b
around the vector axis
. Thus, contrary to the function above, we get a signed angle which will be in the range
The vector axis
needs to be a unit vector and be perpendicular to both vectors a
and b
.
This function uses the geometric definitions of both the scalar and cross product.
We can create the tangent of the angle using both products.
spacedim == 3
.