03-14-2005, 08:11 PM
Pages: 1 2
03-14-2005, 08:47 PM
I'll try to explain:
Look up trigonometry in a math book for a better explanation.
....................Q
................../|
................/..|
............../....|
.....a...../......|
........../........| b
......../..........|
....../............|
..../_______|
P.........c
The angle alpha is the angle between the sides a and c
the angle between the sides b and c is 90 degrees
sin(alpha)=b/a
cos(alpha)=c/a
a*sin(alpha)=b
a*cos(alpha)=c
that means if point P is at the coordinates (0;0)
Point Q will be at the coordinates(a*cos(alpha);a*sin(alpha))
Look up trigonometry in a math book for a better explanation.
....................Q
................../|
................/..|
............../....|
.....a...../......|
........../........| b
......../..........|
....../............|
..../_______|
P.........c
The angle alpha is the angle between the sides a and c
the angle between the sides b and c is 90 degrees
sin(alpha)=b/a
cos(alpha)=c/a
a*sin(alpha)=b
a*cos(alpha)=c
that means if point P is at the coordinates (0;0)
Point Q will be at the coordinates(a*cos(alpha);a*sin(alpha))
03-15-2005, 12:05 AM
um...that helps a little i guess..
03-15-2005, 12:37 AM
mybe somthing like this will help
Y = Sin(ang )*M
X = Cos(ang)*M
M would be the magnatued of the vector
oh ya i think freebasic use's rad's for it sin , cos and tan function so you will have to convert degree's to rad which is
ang in degreas * (Pi/180)
Y = Sin(ang )*M
X = Cos(ang)*M
M would be the magnatued of the vector
oh ya i think freebasic use's rad's for it sin , cos and tan function so you will have to convert degree's to rad which is
ang in degreas * (Pi/180)
03-15-2005, 12:39 AM
Try This:
What exactly are you having problems with? The graphics? The trig? The Radians?
Code:
const PI as double = 3.1415926535897932385
const CircleRadius as double = 9.5
dim angle as double
dim x as double
dim y as double
dim old_x as double
dim old_y as double
screen 18,32,1,1
window screen (-10,10) - (10,-10)
cls
PRINT "Hit Any Key To Begin"
sleep
'Draw some old fashioned X, Y axis
line (-10,0)-(10,0),rgb(255,0,0)
line (0,10)-(0,-10),rgb(255,0,0)
'clear out the key buffer
do while inkey$<>""
loop
for angle = 0 to 2*pi step Pi/12
pset(old_x,old_y),rgb(0,0,0)
x = CircleRadius * cos(angle)
y = CircleRadius * sin(angle)
pset (x,y),rgb(255,255,255)
old_x = x
old_y = y
sleep 500
next angle
sleep
What exactly are you having problems with? The graphics? The trig? The Radians?
03-15-2005, 03:10 AM
The best thing you can do, if you really want to understand what's going on, is Google for 2D rotation tutorials...
Here's one for QB, written by by Toshie Horie. It's got everything you need to know, plus a bunch of stuff that's great to know for making games.
http://www.ocf.berkeley.edu/~horie/qbrotate.html
Here's one for QB, written by by Toshie Horie. It's got everything you need to know, plus a bunch of stuff that's great to know for making games.
http://www.ocf.berkeley.edu/~horie/qbrotate.html
03-15-2005, 03:11 AM
trig and radians... and how it all worx
03-15-2005, 11:22 AM
A good trig book is all you'll ever need to understand them sine's. :*)
03-15-2005, 01:16 PM
Maths are taught at school Trig is taught when pupils are 13 or 14, I think.
03-15-2005, 05:20 PM
OMFG!!! i'm actually starting to get it!!! :bounce:
btw, i'm a highschool dropout, and they didnt teach sin, cos, during the time i was in school
Code:
screen 13
dim x as integer
dim y as integer
dim xval as integer
dim yval as integer
dim xpos as integer
dim ypos as integer
dim angle as double
xval = 160
yval = 100
x = 25
y = 25
do
angle = angle + .01
xpos = x * sin(angle) + y * cos(angle)
ypos = y * sin(angle) - y * cos(angle)
circle (xval + xpos, yval + ypos),15,4
sleep 10
cls
loop
btw, i'm a highschool dropout, and they didnt teach sin, cos, during the time i was in school
Pages: 1 2