pouët.net

Go to bottom

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
Are you have angres ?
added on the 2008-03-14 19:10:45 by keops keops
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
added on the 2008-03-14 19:16:08 by keops keops
newX = 50! + 20!*COS( angle );
newY = 50! + 20!*SIN( angle );
added on the 2008-03-14 19:26:18 by iq iq
BASIC uses teh semicolons now?
added on the 2008-03-14 19:31:07 by doomdoom doomdoom
Yes and newY = 50! - 20!*SIN( angle ); if the higher pixels in the screen has lower Y (Does not happen in CPC basic :)
added on the 2008-03-14 19:39:13 by Optimus Optimus
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?
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*
added on the 2008-03-14 20:41:00 by Danzig Danzig
10 Print "Hallo";
20 Goto 10
added on the 2008-03-14 20:50:25 by Virgill Virgill
here we go danzig...
added on the 2008-03-14 20:51:17 by Virgill Virgill
I fixed it:
10 Print "Hallo";
15 Print " Was? ";
20 Goto 10
added on the 2008-03-14 20:56:20 by Joghurt Joghurt
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
added on the 2008-03-14 21:41:37 by GbND GbND
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. :)
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
added on the 2008-03-14 23:07:11 by Shockwave Shockwave
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. ;)
AMSTRAD BASIC!!!
added on the 2008-03-14 23:31:44 by Optimus Optimus
It's something called Blassic actually. ;)
who is programming "gaysick" anyway ;)
added on the 2008-03-14 23:54:34 by Danzig Danzig
It's all I knows. *sniff*
BASIC FUCK YEAH! *hides*
added on the 2008-03-15 00:38:07 by Alpha C Alpha C
BASSIC
added on the 2008-03-15 01:59:35 by bdk bdk
8bit: try processing

if designers who never learned how to code can use it so can you ;)
added on the 2008-03-15 12:17:35 by psenough psenough
what demonstrates that coding is actually easier than what people thinks ;)
added on the 2008-03-15 12:29:59 by iq iq

login

Go to top