wulfric.absolute_to_relative#
- wulfric.absolute_to_relative(vector, basis)[source]#
Compute relative coordinates of the vector with respect to the basis.
\[\boldsymbol{v} = v^1 \boldsymbol{e_1} + v^2 \boldsymbol{e_2} + v^3 \boldsymbol{e_3}\]We compute scalar products of the vector with the basis vectors:
\[\begin{split}\begin{matrix} \boldsymbol{v} \cdot \boldsymbol{e_1} = v^1\, \boldsymbol{e_1} \cdot \boldsymbol{e_1} + v^2\, \boldsymbol{e_2} \cdot \boldsymbol{e_1} + v^3\, \boldsymbol{e_3} \cdot \boldsymbol{e_1} \\ \boldsymbol{v} \cdot \boldsymbol{e_2} = v^1\, \boldsymbol{e_1} \cdot \boldsymbol{e_2} + v^2\, \boldsymbol{e_2} \cdot \boldsymbol{e_2} + v^3\, \boldsymbol{e_3} \cdot \boldsymbol{e_2} \\ \boldsymbol{v} \cdot \boldsymbol{e_3} = v^1\, \boldsymbol{e_1} \cdot \boldsymbol{e_3} + v^2\, \boldsymbol{e_2} \cdot \boldsymbol{e_3} + v^3\, \boldsymbol{e_3} \cdot \boldsymbol{e_3} \end{matrix}\end{split}\]Which leads to the system of linear equations for \(v^1\), \(v^2\), \(v^3\).
- Parameters:
- vector(3,) array-like
Absolute coordinates of a vector.
- basis(3, 3) array-like
Basis vectors. Rows are interpreted as vectors. Columns are interpreted as coordinates.
- Returns:
- relative(3,) numpy.ndarray
Relative coordinates of the
vectorwith respect to thebasis. \((v^1, v^2, v^3)\).