Opened 4 years ago

#3815 new enhancement

[PATCH] CORDIC algorithm for fast (approximate) computation of length

Reported by: fsincos Owned by:
Priority: Should Have Milestone: Backlog
Component: Core engine Keywords: patch
Cc: Patch:


Since lengths of 2D vectors are used in many performance-critical parts (e.g. the pathfinder), it might make sense to replace it with an approximation that can be computed faster.

The first patch aims to give a rough idea of how it works. There is still a lot of tweaking to be done. In particular, there are two big possible improvements: (1): If we don't need to preserve absolute scale, we can shave off the "Multiply" at the end. For instance, it might not matter if we actually calculate 1.6*length. This would be true for comparisons. (2): The current precision is really good, but it comes at the cost of more iterations. We need to make sure to not introduce bugs though.

A final note: In order to test this patch, apply it and then rename Length_approx to Length and delete the original Length.

Attachments (1)

Length_approx.patch (1.6 KB) - added by fsincos 4 years ago.

Download all attachments as: .zip

Change History (1)

Changed 4 years ago by fsincos

Attachment: Length_approx.patch added
Note: See TracTickets for help on using tickets.