|
tesseract++ 0.0.1
N-dimensional tensor library for embedded systems
|
Cross product for 3-vectors. More...

Go to the source code of this file.
Namespaces | |
| namespace | matrix_algorithms |
Functions | |
| template<typename T , my_size_t N> | |
| FusedVector< T, N > | matrix_algorithms::cross (const FusedVector< T, N > &a, const FusedVector< T, N > &b) |
| Compute the cross product of two 3-vectors. | |
Cross product for 3-vectors.
Computes a × b where a, b ∈ ℝ³. The result is orthogonal to both inputs with magnitude ‖a‖·‖b‖·sin(θ), following the right-hand rule.
(a × b)₀ = a₁·b₂ − a₂·b₁ (a × b)₁ = a₂·b₀ − a₀·b₂ (a × b)₂ = a₀·b₁ − a₁·b₀
Fully unrolled — O(1), 6 multiplies + 3 subtracts. Works on any scalar type including integers.
The cross product is only defined for N=3. Other dimensions are rejected at compile time.