Difference between revisions of "Byte angle"

From Eternity Wiki
Jump to: navigation, search
(Created page with "A byte angle is from 0 to 255, where 0 means east, 64 north, 128 west and 192 south.")
 
 
Line 1: Line 1:
A byte angle is from 0 to 255, where 0 means east, 64 north, 128 west and 192 south.
+
Byte angles follow this system:
 +
:0 =  0 degrees (East)
 +
:64 =  90 degrees (North)
 +
:128 = 180 degrees (West)
 +
:192 = 270 degrees (South)
 +
 
 +
To convert from degrees to byte angles, use the following calculation:
 +
 
 +
byteangle = (degrees * 256) / 360
 +
 
 +
Chop or round the result to an integer.
 +
 
 +
Valid byte angles fall between 0 and 255, so adjust any angles less than 0 or greater than or equal to 360 before performing this conversion.

Latest revision as of 12:45, 6 August 2016

Byte angles follow this system:

0 = 0 degrees (East)
64 = 90 degrees (North)
128 = 180 degrees (West)
192 = 270 degrees (South)

To convert from degrees to byte angles, use the following calculation:

byteangle = (degrees * 256) / 360

Chop or round the result to an integer.

Valid byte angles fall between 0 and 255, so adjust any angles less than 0 or greater than or equal to 360 before performing this conversion.