Calculate vector direction
Posted
by
Starkers
on Game Development
See other posts from Game Development
or by Starkers
Published on 2014-05-27T03:14:31Z
Indexed on
2014/05/27
3:43 UTC
Read the original article
Hit count: 255
mathematics
|vector
Is the direction angle always measured from the plus x axis?
Does a vector in the +,+
quadrant always have a direction between 0 and 90
,
and in -,+
between 90 and 180
and in -,-
between 180 and 270
and in -,+
between 270 and 360
?
Also, how should we calculate the direction using tan
? Would that mean nested if statements to find out what quadrant we're in, and then applying the appropriate "work arounds"? E.g. If we were in the -,+
(like in the diagram) would we find the angle from the + axis would be 90 +
tan^-1(y/x)
, the 90 +
only used because we're in the -,+
quadrant. Also, that's just a quick solution, may be off, I just want to know if we use nested if statements to get the angle from the + x axis.
Finally, should we find the distance in degrees or radians?
© Game Development or respective owner