JuliaGeometry / JuliaGeometry/Rotations.jl

Add `ComplexRotation <: Rotation{2}`

Open
#270 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Julia
Stars
188
Forks
45
PR merge metrics
No merged PRs in 30d

Description

We now have two types for 2D rotations:

  • RotMatrix{2} stores four real values as a matrix
  • Angle2d stores one real value as a rotation angle

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

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading src/rotation_between.jl at the linked lines, then compare how RotMatrix{2} and Angle2d implement the Rotation{2} interface. The issue is done when ComplexRotation{T} is added as the proposed Rotation{2,T} implementation and can support the 2D-vector rotation use case described by rotation_between.

Written by the indexing model from the issue text.

Assessment

Tech stack
julia
Domain
computer-graphics
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.