Open hyrodium opened 11 months ago
We now have two types for 2D rotations:
RotMatrix{2}
Angle2d
However, a 2D rotation can be parametrized with two real values $(c,s)$ like
$$ R = \begin{pmatrix}c & -s \\ s & c\end{pmatrix}. $$
This rotation is the same as a rotation by a complex number $c+is$, and can be implemented like this:
struct ComplexRotation{T} <: Rotation{2,T} c::Complex{T} end
This is sometimes useful when we need to generate a rotation from 2D vectors. See rotation_between for example. https://github.com/JuliaGeometry/Rotations.jl/blob/f00b07d9d809717bfb6b1d9fc3966e6be059af22/src/rotation_between.jl#L9-L15
rotation_between
We now have two types for 2D rotations:
RotMatrix{2}
stores four real values as a matrixAngle2d
stores one real value as a rotation angleHowever, a 2D rotation can be parametrized with two real values $(c,s)$ like
$$ R = \begin{pmatrix}c & -s \\ s & c\end{pmatrix}. $$
This rotation is the same as a rotation by a complex number $c+is$, and can be implemented like this:
This is sometimes useful when we need to generate a rotation from 2D vectors. See
rotation_between
for example. https://github.com/JuliaGeometry/Rotations.jl/blob/f00b07d9d809717bfb6b1d9fc3966e6be059af22/src/rotation_between.jl#L9-L15