Reputation: 2148
I have seen many implementations for this but I got this new idea about which I couldn't be sure. So I need an opinion here.
The idea is that instead of looking up the table for arctan(gy/gx)
, look for 1/gx
in one table and multiply the result with gy
. Then lookup for arctan
. The reason for doing so is to reduce hardware cost as division is more expensive than multiplication. But the limitation is that I can have a maximum of 10 address bits
. Whereas, multiplication will give me twice the number of bits in gx
. gx
itself is 8 bits. If I right shift gy*(1/gx)
by 6 bits to get a 10 bit address,
What could be the degree of error?
Upvotes: 2
Views: 1465
Reputation: 7824
Note you only need to consider the case when gy > gx
as arctan(gy/gx)=90-arctan(gx/gy)
(assuming we are working in degrees in positive coordinate). This might reduce you errors with division.
Upvotes: 3