Functions | |
| template<std::floating_point ScalarType> | |
| dense::Mat< ScalarType, 3, 3 > | trafo_mat_cartesian_to_normal_tangential (const dense::Vec< ScalarType, 3 > &n_input) |
| Constructs a robust orthonormal transformation matrix from Cartesian to (normal–tangential–tangential) coordinates. | |
| template<std::floating_point ScalarType> | |
| dense::Mat< ScalarType, 3, 3 > | trafo_mat_normal_tangential_to_cartesian_trafo (const dense::Vec< ScalarType, 3 > &n_input) |
| Constructs the inverse transformation matrix from (normal–tangential–tangential) to Cartesian coordinates. | |
| template<std::floating_point ScalarType, std::floating_point ScalarTypeGrid, util::FlagLike FlagType> | |
| void | cartesian_to_normal_tangential_in_place (VectorQ1Vec< ScalarType, 3 > &vec_cartesian, const grid::Grid3DDataVec< ScalarTypeGrid, 3 > &coords_shell, const grid::Grid4DDataScalar< FlagType > mask_data, const FlagType &flag) |
| template<std::floating_point ScalarType, std::floating_point ScalarTypeGrid, util::FlagLike FlagType> | |
| void | normal_tangential_to_cartesian_in_place (VectorQ1Vec< ScalarType, 3 > &vec_normal_tangential, const grid::Grid3DDataVec< ScalarTypeGrid, 3 > &coords_shell, const grid::Grid4DDataScalar< FlagType > mask_data, const FlagType &flag) |
| void terra::linalg::trafo::cartesian_to_normal_tangential_in_place | ( | VectorQ1Vec< ScalarType, 3 > & | vec_cartesian, |
| const grid::Grid3DDataVec< ScalarTypeGrid, 3 > & | coords_shell, | ||
| const grid::Grid4DDataScalar< FlagType > | mask_data, | ||
| const FlagType & | flag | ||
| ) |
| void terra::linalg::trafo::normal_tangential_to_cartesian_in_place | ( | VectorQ1Vec< ScalarType, 3 > & | vec_normal_tangential, |
| const grid::Grid3DDataVec< ScalarTypeGrid, 3 > & | coords_shell, | ||
| const grid::Grid4DDataScalar< FlagType > | mask_data, | ||
| const FlagType & | flag | ||
| ) |
| dense::Mat< ScalarType, 3, 3 > terra::linalg::trafo::trafo_mat_cartesian_to_normal_tangential | ( | const dense::Vec< ScalarType, 3 > & | n_input | ) |
Constructs a robust orthonormal transformation matrix from Cartesian to (normal–tangential–tangential) coordinates.
Given a surface normal n, this function returns the 3×3 matrix \( R \) whose rows form a right-handed orthonormal basis \( \{ \hat{n}, \mathbf{t}_1, \mathbf{t}_2 \} \) such that:
\[ \mathbf{v}_{\text{local}} = R \, \mathbf{v}_{\text{cartesian}}, \qquad \mathbf{v}_{\text{cartesian}} = R^{\mathsf{T}} \, \mathbf{v}_{\text{local}} . \]
The basis vectors are constructed as:
This ensures numerical stability even when \( \hat{n} \) is nearly axis-aligned.
| ScalarType | Floating-point scalar type (e.g. float, double). |
| n_input | Surface normal vector at the point of interest (not required to be unit length). |
| dense::Mat< ScalarType, 3, 3 > terra::linalg::trafo::trafo_mat_normal_tangential_to_cartesian_trafo | ( | const dense::Vec< ScalarType, 3 > & | n_input | ) |
Constructs the inverse transformation matrix from (normal–tangential–tangential) to Cartesian coordinates.
This function returns the transpose of the orthonormal transformation matrix \( R \) produced by trafo_mat_cartesian_to_normal_tangential, since for an orthonormal basis \( R^{-1} = R^{\mathsf{T}} \).
Hence, for any vector \( \mathbf{v} \):
\[ \mathbf{v}_{\text{local}} = R \, \mathbf{v}_{\text{cartesian}}, \qquad \mathbf{v}_{\text{cartesian}} = R^{\mathsf{T}} \, \mathbf{v}_{\text{local}} . \]
| ScalarType | Floating-point scalar type (e.g. float, double). |
| n_input | Surface normal vector at the point of interest (not required to be unit length). |