Calculator Community > Grammer
[grammer] Problem with trigonometry
persalteas:
In this TI-Planet topic (reading not required), we were making comparisons between Basic and Axe means to make a laser rotation like this:
I wanted to try to do this in Grammer, because it combinates the speed of Axe and the lightness of Basic :P
But, as Grammer has no "Degree" mode, i did not manage to make it.
My code looks like this, now: (I added a patern to the line for fun)
--- Code: ---:.0:Return
:0->A
:1->B
:ClrDraw
:Return->Z
:A+1->A
:call Lbl "D
:Text('0,0,A
:DispGraph
:Pause 10
:B=0:->B
:call Lbl "D
:Goto Z
:.D
:Rect('47,31,47+100*sin(A),37+100*cos(A),B+4,,2
:End
--- End code ---
And... it works not. Can you explain me why ?
Thanks
mdr1:
Could you say what the problem is ?
Xeda112358:
sin() and cos() in Grammer are basically the same as in Axe. It returns a value from -127 to 127, so when you multiply by 100, it goes way off screen. Here is my rendition:
--- Code: ---.0:Return
0→A→E
Repeat getKey(15
ClrDraw
IS>(A ;just to increment A
Text('ºA and 255
62+sin(A
/ 2→B
94+cos(A
/ 2→C
Line('47,31,C,B
Line('48,31,C+1,B
Line('47,32,C,B+1
DispGraph
End
Stop
--- End code ---
persalteas:
Thanks !
I don't understand your code, but thanks, that will be very good enough ! :)
Matrefeytontias:
I say : mine is still faster, you've lost Persalteas :P and it'll be even faster when I'll insert it in IkarugaX's engine.
Navigation
[0] Message Index
[#] Next page
Go to full version