Expand description
Vectors of the three-dimensional Euclidean space, as [f64; 3]: the scalar product,
the difference, the norm and the direction of a vector, and the unit vector of
spherical angles.
The geometry of the antenna arrays of the CDL channel and of the indoor optical channel (positions, directions, orientations) is written with these.
§Examples
use comnum_math::geometry::{difference, dot, norm, unit};
let (a, b) = ([1.0, 2.0, 2.0], [1.0, 0.0, 0.0]);
assert_eq!(dot(a, b), 1.0);
assert_eq!(norm(a), 3.0);
assert_eq!(difference(a, b), [0.0, 2.0, 2.0]);
assert_eq!(unit([0.0, 0.0, -2.0]), Some([0.0, 0.0, -1.0]));§Spherical angles
from_spherical takes the zenith (polar) angle $\theta$ from $+z$ and the azimuth
$\phi$ from $+x$ towards $+y$, in radians (ISO 80000-2; the angles of 3GPP TR 38.901,
(7.5-23)):
$$ \hat{r}(\theta, \phi) = (\sin\theta \cos\phi,\ \sin\theta \sin\phi,\ \cos\theta)^{T}. $$
An elevation $\epsilon$ above the $xy$ plane is the zenith $\theta = \pi/2 - \epsilon$.
Functions§
- difference
- The difference $a - b$.
- dot
- The scalar product $a \cdot b = a_{0} b_{0} + a_{1} b_{1} + a_{2} b_{2}$.
- from_
spherical - The unit vector $\hat{r}(\theta, \phi) = (\sin\theta \cos\phi, \sin\theta \sin\phi,
\cos\theta)$ of the zenith
zenith_rad(from $+z$) and the azimuthazimuth_rad(from $+x$ towards $+y$), see the module. - norm
- The Euclidean norm $\lVert a \rVert = \sqrt{a \cdot a}$.
- unit
- The direction $a / \lVert a \rVert$ of
a;Nonefor a zero or non-finite norm.
Type Aliases§
- Vec3
- A vector of the three-dimensional space.