Accessing SIN/COS tables in SPIN
Javalin
Posts: 892
Hello all,
Is there some example code available for accessing the sine/cosine tables via SPIN?
I've looked in the manual, and some of the float examples/library's
Particuarly I am after SIN functions
Cheers
James
Is there some example code available for accessing the sine/cosine tables via SPIN?
I've looked in the manual, and some of the float examples/library's
Particuarly I am after SIN functions
Cheers
James
Comments
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Ken - The floating point object is ASM only.....
Cheers both,
James
http://forums.parallax.com/showthread.php?p=606978
There are a couple of versions, both spin and asm.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Tracy Allen
www.emesystems.com
Andy
Thanks!!!!!
James
Couple of possibly silly questions if I may!
1) If I am passing an angle in degrees to the "fullsine" function - do I need to * 22 to get the 0-8192 = 0-360 resolution? I guess so?
2) Is there an easy way of converting the 2's complement output to a decimal distance (+ or -) ??
My Math is rubbish - sorry!
Cheers,
James
Andy
Post Edited (Ariba) : 5/20/2008 3:38:55 PM GMT
Sorry - Im not sure what the range parameter here is doing? Can you give an example?
James
Using Tracy's fullsine function to find the opposite on a triangle, I do the following and I get:
· "result a=682 hyp=5 sine=44 opp=220"
Sure Im doing something really stupid but also·really struggling to get my head around this one.
According to excel (and my drawing) I should get:
· Hyp = 6 (actually 5.8 but rounded)
· Sine·= 0.515 ish
··Opposite is 3.
Cheers all
James
Post Edited (Javalin) : 5/21/2008 5:11:26 PM GMT
with the function above: sin(x,1000) gives a result from -1000 to +1000, sin(x,256) results in -256..+256
with concrete numbers:
sin(0,1000) = 0, sin(45,1000) = 707, sin(90,1000) = 1000 and so on...
Here is an example that uses sin and cos to draw circles on PropTerminal:
Andy
Thanks!
james