JuliaGeometry / Rotations.jl

Julia implementations for different rotation parameterizations
https://juliageometry.github.io/Rotations.jl
MIT License
176 stars 44 forks source link

Add `ComplexRotation <: Rotation{2}` #270

Open hyrodium opened 11 months ago

hyrodium commented 11 months ago

We now have two types for 2D rotations:

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