Need programming help.
category: general [glöplog]
My maths is totally no-existant and i'm looking at doing a certain calculation in basic.
From point a, i need to plot another point so many degrees. So if x and y are 50 and i want to move 20 points south you'll add 20 to y. Thing is i can't figure out the more fiddly angles.
TIA
From point a, i need to plot another point so many degrees. So if x and y are 50 and i want to move 20 points south you'll add 20 to y. Thing is i can't figure out the more fiddly angles.
TIA
Are you have angres ?
After reading your message 3 times I still don't understand your question but this might probably help :
http://mathworld.wolfram.com/Trigonometry.html
http://mathworld.wolfram.com/InverseCosine.html
http://mathworld.wolfram.com/DotProduct.html
http://mathworld.wolfram.com/Trigonometry.html
http://mathworld.wolfram.com/InverseCosine.html
http://mathworld.wolfram.com/DotProduct.html
newX = 50! + 20!*COS( angle );
newY = 50! + 20!*SIN( angle );
newY = 50! + 20!*SIN( angle );
BASIC uses teh semicolons now?
Yes and newY = 50! - 20!*SIN( angle ); if the higher pixels in the screen has lower Y (Does not happen in CPC basic :)
Thanks for the replys guys. They work pretty well apart from one exception.....
the angles being drawn don't correspond to the angles being inputted. :S
For the angles var i'm using 1 to 360, i take it this is wrong?
the angles being drawn don't correspond to the angles being inputted. :S
For the angles var i'm using 1 to 360, i take it this is wrong?
not actually knowing what form of basic you're using, you might want to make sure that 'angle' is in radians before you plug it into cos/sin
That would explain a lot, cheers. :)
I hereby express my disrespect to all who posted.... you shall not forget the obligatory pouet-flaming! *LOL*
10 Print "Hallo";
20 Goto 10
20 Goto 10
here we go danzig...
I fixed it:
10 Print "Hallo";
15 Print " Was? ";
20 Goto 10
10 Print "Hallo";
15 Print " Was? ";
20 Goto 10
Wasn't the ';' just to remove the carriage return/newline pair from a ? statement? (On the Apple ][e)
Code:
10 ? "HOME "
20 ? "SWEET "
30 GOTO 10
Hah, remember programming those at school.
I got the basics running anyway, you lot could probably do it in your sleep anyways. :P
All it was was to draw a line from the previous point to a new point at a new angle and keep repeating the process. :)
I got the basics running anyway, you lot could probably do it in your sleep anyways. :P
All it was was to draw a line from the previous point to a new point at a new angle and keep repeating the process. :)
Quote:
Thanks for the replys guys. They work pretty well apart from one exception.....
the angles being drawn don't correspond to the angles being inputted. :S
For the angles var i'm using 1 to 360, i take it this is wrong?
degree=radian*pi/180
10 CLEAR
20 MODE 1
21 cx=80:cy=80:a=97
22 x1=0:y1=0:MOVE cx+x1,cy+y1
40 x1=10*COS(a*PI/180)
50 y1=10*SIN(a*PI/180)
80 DRAW cx+x1,cy+y1
81 cx=cx+x1:cy=cy+y1
90 IF b=4 THEN END
100 FOR l=1 TO 1000000:NEXT l
110 a=INT(RND*360)+1:b=b+1
120 GOTO 40
It seems to do what i need anyways. This was only a test. ;)
20 MODE 1
21 cx=80:cy=80:a=97
22 x1=0:y1=0:MOVE cx+x1,cy+y1
40 x1=10*COS(a*PI/180)
50 y1=10*SIN(a*PI/180)
80 DRAW cx+x1,cy+y1
81 cx=cx+x1:cy=cy+y1
90 IF b=4 THEN END
100 FOR l=1 TO 1000000:NEXT l
110 a=INT(RND*360)+1:b=b+1
120 GOTO 40
It seems to do what i need anyways. This was only a test. ;)
AMSTRAD BASIC!!!
It's something called Blassic actually. ;)
who is programming "gaysick" anyway ;)
It's all I knows. *sniff*
BASIC FUCK YEAH! *hides*
BASSIC
what demonstrates that coding is actually easier than what people thinks ;)