Binary angular measurement: Difference between revisions

Content deleted Content added
Unsigned fraction of turn: Fixed grammatical error
Tags: Mobile edit Mobile web edit
Add GPS broadcast signal example. It *may* be used when counting full turns, as the fractional part of a fixed-point count of rotations. Move figure to the "signed fraction" section where it belongs best.
Line 1:
{{Use dmy dates|date=December 2022|cs1-dates=y}}
{{Use list-defined references|date=December 2022}}
'''Binary angular measurement''' ('''BAM''')<ref name="ship"/> (and the '''binary angular measurement system''', '''BAMS'''<ref name="BAMS"/>) is a measure of [[angle]]s using [[binary number]]s and [[fixed-point arithmetic]], in which a halffull [[turn (angle)|turn]] is represented by the value 1. The [[unit of measure|unit]] of angular measure used in those methods may be called '''binary radian''' ('''brad''') or '''binary degree'''.
 
These representation of angles are often used in [[numerical control]] and [[digital signal processing]] applications, such as robotics, navigation,<ref name="lap2004"/> computer games,<ref name="sang1993"/> and digital sensors.,<ref name="para2005"/> taking Onadvantage of the otherimplicit hand,modular thisreduction systemachieved isby nottruncating adequatebinary fornumbers. It may also be situationsused whereas the number[[fractional part]] of fulla [[turnfixed-point (angle)|turnnumber]]s mustcounting bethe measured,number of full rotations of e.g. to monitor the rotation ofa vehicle's wheels or ofa [[leadscrew]]s.
 
[[Image:Binary angles.svg|360px|thumb|Binary angle measurement system. <span style="color:black">Black</span> is traditional degrees representation, <span style="color:green">green</span> is a BAM as a decimal number and <span style="color:red">red</span> is [[hexadecimal]] 32-bit BAM. In this figure the 32-bit binary integers are interpreted as signed binary fixed-point values with scaling factor 2<sup>−31</sup>, representing fractions between −1.0 (inclusive) and +1.0 (exclusive).]]
 
==Representation==
Line 16 ⟶ 14:
 
===Signed fraction of turn===
[[Image:Binary angles.svg|360px|thumb|BinarySigned binary angle measurement system. <span style="color:{{black">|Black</span>}} is traditional degrees representation, <span style="color:{{green">|green</span>}} is a BAM as a decimal number and <span style="color:{{red">|red</span>}} is [[hexadecimal]] 32-bit BAM. In this figure the 32-bit binary integers are interpreted as signed binary fixed-point values with scaling factor 2<sup>−31</sup>, representing fractions between −1.0 (inclusive) and +1.0 (exclusive).]]
Alternatively, the same ''n'' bits can also be interpreted as a signed integer in the range −2<sup>''n''−1</sup>, ..., 2<sup>''n''−1</sup>−1 in the [[two's complement]] convention. They can also be interpreted as a fraction of a full turn between −0.5 (inclusive) and +0.5 (exclusive) in signed fixed-point format, with the same scaling factor; or a fraction of half-turn between −1.0 (inclusive) and +1.0 (exclusive) with scaling factor 1/2<sup>''n''−1</sup>.
 
Either way, these numbers can then be interpreted as angles between −180° (inclusive) and +180° (exclusive), with −0.25 meaning −90° and +0.25 meaning +90°. The result of adding or subtracting the numerical values will have the same sign as the result of adding or subtracting angles, once reduced to this range. This interpretation eliminates the need to reduce angles to the range {{closed-closed|−π, +π}} when computing [[trigonometric functions]].
 
==Example==
In the orbital data broadcast by the [[Global Positioning System]], angles are encoded using binary angular measurement. In particular, each satellite broadcasts an [[ephemeris]] containing its six Keplerian [[orbital elements]]. Four of these are angles, which are encoded as 32-bit binary angles. In the lower-precision [[GPS signals#Almanac|almanac]] data, 24-bit binary angles are used.<!--Except for inclination, which is specially encoded, a detail considered too esoteric to mention here.-->
 
==See also==
Line 31 ⟶ 33:
<ref name="BAMS">{{cite web |title=Binary Angular Measurement System |work=acronyms.thefreedictionary |url=http://acronyms.thefreedictionary.com/Binary+Angular+Measurement+System}}</ref>
<ref name="harg2019">{{cite web |title=Angles, integers, and modulo arithmetic |author-first=Shawn |author-last=Hargreaves |author-link=:pl:Shawn Hargreaves |publisher=blogs.msdn.com |url=http://blogs.msdn.com/shawnhar/archive/2010/01/04/angles-integers-and-modulo-arithmetic.aspx |access-date=2019-08-05 |url-status=live |archive-url=https://web.archive.org/web/20190630223817/http://www.shawnhargreaves.com/blogindex.html |archive-date=2019-06-30}}</ref>
<ref name="lap2004">{{cite book |title=Real-Time Systems Design and Analysis |chapter=Chapter 7.5.3, Binary Angular Measure |author-first=Phillip A. |author-last=LaPlante |date=2004 |website=www.globalspec.com |chapter-url=http://www.globalspec.com/reference/14722/160210/Chapter-7-5-3-Binary-Angular-Measure |isbn=0-471-22855-9}}</ref>
<ref name="sang1993">{{cite web |title=Doom 1993 code review - Section "Walls" |author-first=Fabien |author-last=Sanglard |date=2010-01-13 |website=fabiensanglard.net |url=http://fabiensanglard.net/doomIphone/doomClassicRenderer.php}}</ref>
<ref name="para2005">{{cite web |title=Hitachi HM55B Compass Module (#29123) |series=Parallax Digital Compass Sensor (#29123) |publisher=[[Parallax, Inc. (company)|Parallax, Inc.]] |date=May 2005 |website=www.hobbyengineering.com |via=www.parallax.com |url=http://www.hobbyengineering.com/specs/PX-29123.pdf |url-status=dead |archive-url=https://web.archive.org/web/20110711172521/http://www.hobbyengineering.com/specs/PX-29123.pdf |archive-date=2011-07-11}}</ref>