Merge pull request #3162 from Citadel-Station-13/upstream-merge-30989
[MIRROR] Makes angle2dir() much more accurate
This commit is contained in:
+19
-16
@@ -125,22 +125,25 @@
|
|||||||
/proc/angle2dir(degree)
|
/proc/angle2dir(degree)
|
||||||
|
|
||||||
degree = SimplifyDegrees(degree)
|
degree = SimplifyDegrees(degree)
|
||||||
|
switch(degree)
|
||||||
if(degree < 45)
|
if(0 to 22.5) //north requires two angle ranges
|
||||||
return NORTH
|
return NORTH
|
||||||
if(degree < 90)
|
if(22.5 to 67.5) //each range covers 45 degrees
|
||||||
return NORTHEAST
|
return NORTHEAST
|
||||||
if(degree < 135)
|
if(67.5 to 112.5)
|
||||||
return EAST
|
return EAST
|
||||||
if(degree < 180)
|
if(112.5 to 157.5)
|
||||||
return SOUTHEAST
|
return SOUTHEAST
|
||||||
if(degree < 225)
|
if(157.5 to 202.5)
|
||||||
return SOUTH
|
return SOUTH
|
||||||
if(degree < 270)
|
if(202.5 to 247.5)
|
||||||
return SOUTHWEST
|
return SOUTHWEST
|
||||||
if(degree < 315)
|
if(247.5 to 292.5)
|
||||||
return WEST
|
return WEST
|
||||||
return NORTH|WEST
|
if(292.5 to 337.5)
|
||||||
|
return NORTHWEST
|
||||||
|
if(337.5 to 360)
|
||||||
|
return NORTH
|
||||||
|
|
||||||
//returns the north-zero clockwise angle in degrees, given a direction
|
//returns the north-zero clockwise angle in degrees, given a direction
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user