Skip to content

[FEATURE] Implement CORDIC algorithm #1165

@Chlorophytus

Description

@Chlorophytus

New algorithm implementation. This is complex to explain but I will explain it further if needed :)

Detailed Description

Implement the CORDIC algorithm.

Context

This is for microcontrollers/microprocessors that don't have Floating Point Units, or they don't accelerate std::sin nor std::cos, or (most likely) for users who want to use/implement a clean-room CORDIC utilizing the repository's MIT License.

Possible Implementation

The CORDIC algorithm is a well-documented recursive algorithm.

Given a lookup table of arctangents (X offsets on a unit circle) partitioned evenly by a power of two, divided 0° to 90°:

  • Start off at 0°.
  • Rotate the arctangent table by 45°.
  • Successive rotations are based on greater-than/less-than comparisons on the angle, then divided the rotation amount by 2.
  • The sines and cosines are the X and 1.0f-X offsets.

For example:

Given an angle 10°:

  • Start off at 0°
  • 45°
  • 45° divided by 2 is 22.5°
  • 22.5 is more than 10°, rotate counterclockwise by 22.5 divided by 2 which is 11.25°.
  • We are now at 11.25°. We can stop here because our lookup table should have 11.25° if we partitioned it at least by that granularity.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requeststaleAuthor has not responded to the comments for over 2 weeks

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions