Fixed Point ASIN ?
epmoyer
Posts: 314
Is there a fixed point Arc Sin (ASIN) routine out there for the Propeller?
I'm looking to use it in a Hydra game (SpaceWar). My concern is that the best way to do it is probably some kind of a newton's method search of the sin table, which is bound to be both non-deterministic (i.e. take different amounts of time depending on the query value), and be dog slow.
For what I'm doing it may be sufficient for me to create my own reverse lookup table with limited angular resolution (its just a game, after all [noparse]:)[/noparse], but if there was something usable out there already I'd rather make use of it.
Thanks
I'm looking to use it in a Hydra game (SpaceWar). My concern is that the best way to do it is probably some kind of a newton's method search of the sin table, which is bound to be both non-deterministic (i.e. take different amounts of time depending on the query value), and be dog slow.
For what I'm doing it may be sufficient for me to create my own reverse lookup table with limited angular resolution (its just a game, after all [noparse]:)[/noparse], but if there was something usable out there already I'd rather make use of it.
Thanks
Comments
Here is a reverse sine lookup method using 11 iterations that is exactly what Mike describes.
The main core of it (Function Engine) written in assembly is really all that is needed.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Beau Schwabe
IC Layout Engineer
Parallax, Inc.
· Is there a way to use or modify the code that Beau posted in a manner that does not·require an extra cog?
·I am cog limited at the moment and am (unfortunately) not very strong in assembly.
Any thoughts or guidance would be appreciated!!!
-Jason
If you already have an object written in Assembly, you can cut-n-paste the required portions of my code into your Assembly object....
Alternatively you could use spin from your main cog... I'll look and see, but I don't think I have it any more. Originally before I converted
the function to Assembly it was in Spin.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Beau Schwabe
IC Layout Engineer
Parallax, Inc.
· Beau, if you happen to come across the spin implementation I would appreciate it.
Thank you all for your input!
-Jason
About the only thing I could fine was a Program that I wrote in QuickBasic4.5 to prove the concept.··It's simply a software version of the classic game ... "guess what number" in as few steps as possible.· The only feed back you get is if the 'actual' number is higher or lower than the guessed number.
·
If you don't need as much·accuracy, then you can shorten the number of steps.· 11-steps were used to correlate with the 13-bit resolution of the sine table built in the Propeller ROM.· The "missing" two bits are because the ROM table only holds 1/4 of the Sine table (... or 11 bits) the other two bits are derived by translation. (Flipping/Mirroring)
·
·Note: In QuickBasic4.5 code, the ''/" division bar indicates standard floating point division.· When the "\" division bar is used·it indicates integer division.
·········
·
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Beau Schwabe
IC Layout Engineer
Parallax, Inc.
Post Edited (Beau Schwabe (Parallax)) : 4/4/2008 4:40:40 AM GMT
· Thank you very much!· This is something I can work with!· I appreciate you taking the time to find this.
-Jason