![]() |
Reference documentation for deal.II version 9.4.2
|
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 ![$[0, \pi]$](form_2476.png)
This function uses the geometric definition of the scalar product.
![\[
\vec{a} \cdot \vec{b} = \|\vec{a}\| \|\vec{b}\| \cos(\theta)
\]](form_2477.png)
| 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 ![$[-\pi, \pi]$](form_2478.png)
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.
![\[
\tan{\theta}
= \frac{\sin(\theta)}{\cos(theta)}
= \frac{(\vec{a} \times \vec{b}) \cdot \vec{n}}{\vec{a} \cdot \vec{b}}
\]](form_2480.png)
spacedim == 3.