Lolol,
Maths man, I just dont get it, never have, doubt I ever will.
The only time in my life I had some basic maths going was when I was a cashier at a bookmakers, after a few weeks I didnt even have to think, the numbers appeared to me from nowhere.
translating x/y to angle?
Moderator: Moderators
-
PKM
- General
- Posts: 1888
- Joined: Tue Aug 09, 2005 4:43 pm
- Location: Philadelpia but stuck in San Antonio TX (hell)
correction: civilization is built on math, not the world. if you say you can see math in nature then that is an observation not a fact. the church of me abhors math. it may explain why our offerings are always a little off with each count. either that or deacon _map is pilfering again.TopTiger wrote:well the world is built on maths... I hate maths... and i study civil engineeringi'm a little weird.
but this topic is about the 2d game...
i'm not f****** angry, i'm from philadelphia .


I study in Alkmaar (HBO). Still need to go 3 years, but it's very interesting. I might go to TU delft, but then I have another 3-4 years to go.jv_map wrote:<<< Sorry for off topic>>>
Just wondering, where do you study CE TopTiger?
sry for off topic.
ontopic:
Lizard, are there any ss of that 2d game?
yes, civilization, srycorrection: civilization is built on math, not the world. if you say you can see math in nature then that is an observation not a fact. the church of me abhors math. it may explain why our offerings are always a little off with each count. either that or deacon _map is pilfering again.
jv:
the arctan thing seems almost works, however they face the wrong ways... and not in the absolute opposite direction, but at an angle to it. this may be one of my methods with rotation or something, but i htink i got the radians to degrees thing mixed up. i did the
( tan(y/x)^-1 )
thing, and then divided that number by this
( PI / 180 )
[ ( tan(y/x)^-1 ) / ( PI / 180 ) ]
is that correct? i'm double checking my functions and there's nothing overly obvious but if i've got the calculations right then i'll take a deeper look.
TopTiger:
You really don't want SS's of it
at this stage, it's a bunch of round red and blue circular images moving around the screen to different points (a lot of times bouncing off them) while various other features run... it's not that exciting, yet 
When i get it to a workable stage maybe i'll post something, but it wont be very soon
Personally, math hasn't ever struck it with me. i have a basic enough feel and i can understand some stuff like this.. but tbh, i dont enjoy it. it's just a tool for me. i enjoy games and the creation of them, and since math is an essential part... well there ya go. just like Rad or anything else to me
the arctan thing seems almost works, however they face the wrong ways... and not in the absolute opposite direction, but at an angle to it. this may be one of my methods with rotation or something, but i htink i got the radians to degrees thing mixed up. i did the
( tan(y/x)^-1 )
thing, and then divided that number by this
( PI / 180 )
[ ( tan(y/x)^-1 ) / ( PI / 180 ) ]
is that correct? i'm double checking my functions and there's nothing overly obvious but if i've got the calculations right then i'll take a deeper look.
TopTiger:
You really don't want SS's of it
When i get it to a workable stage maybe i'll post something, but it wont be very soon
Personally, math hasn't ever struck it with me. i have a basic enough feel and i can understand some stuff like this.. but tbh, i dont enjoy it. it's just a tool for me. i enjoy games and the creation of them, and since math is an essential part... well there ya go. just like Rad or anything else to me
Moderator
۞
Abyssus pro sapientia
Olympus pro Ignarus
۞
AND STUFF™ © 2006
۞
Abyssus pro sapientia
Olympus pro Ignarus
۞
AND STUFF™ © 2006
Hmm well it could be 3 things:
1) The arctan you are using returns the angle in degrees. Try it without the 180/pi factor.
2) You are not using arctan but 1/tan. At least the way you wrote it suggests this.
tan^-1 (x) != [tan(x)]^-1
This is why generally the notation arctan(x) or atan(x) is preferred over tan^-1 (x).
3) A definition problem.
The angle you will get from the inverse tan is the following:
Given the point (x,y) then:
a = atan(y/x); when x > 0
a = atan(y/x) + pi; when x < 0
a = pi/2; when x = 0 and y > 0
a = -pi/2; when x = 0 and y < 0
a is undefined; when x = 0 and y = 0
However, in computer graphics, the y axis of a screen is often oriented down instead of up, so you will get the angle the other way around.
<<< Sorry for offtopic
>>>
Ah very cool TopTiger
.. I'm in Delft currently doing Aerospace Engineering.. Not a bad idea to go here after your HBO.. I believe you can already start your MSc programme after only a 1 year transfer programme, so that's pretty sweet
.. only problem is they like concrete so much the CE building looks like a forgotten nazi bunker 
1) The arctan you are using returns the angle in degrees. Try it without the 180/pi factor.
2) You are not using arctan but 1/tan. At least the way you wrote it suggests this.
tan^-1 (x) != [tan(x)]^-1
This is why generally the notation arctan(x) or atan(x) is preferred over tan^-1 (x).
3) A definition problem.
The angle you will get from the inverse tan is the following:
Code: Select all
y
^ (x,y)
| /
| /
| /
| /
|/ ) a
0------------->x
a = atan(y/x); when x > 0
a = atan(y/x) + pi; when x < 0
a = pi/2; when x = 0 and y > 0
a = -pi/2; when x = 0 and y < 0
a is undefined; when x = 0 and y = 0
However, in computer graphics, the y axis of a screen is often oriented down instead of up, so you will get the angle the other way around.
<<< Sorry for offtopic
Ah very cool TopTiger
-
Rookie One.pl
- Site Admin
- Posts: 2752
- Joined: Fri Jan 31, 2003 7:49 pm
- Location: Nowa Wies Tworoska, Poland
- Contact:


