Binary angular measurement: Difference between revisions

Content deleted Content added
CE
Line 1:
{{use dmy dates|date=December 2022|cs1-dates=y}}
{{use list-defined references|date=December 2022}}
The terms '''binary angular measurement''' ('''BAM''')<ref name="ship"/> and '''binary angular measurement system''' ('''BAMS''')<ref name="BAMS"/> refer to certain methodologies for representing and manipulating [[angle]]s using [[binary number|binary]] ([[number base|base]] 2) [[fixed-point arithmetic]]. 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"/> On the other hand, this system is not adequate for situations where the number of full turns[[turn (angle)|turn]]s must be measured, e.g. to monitor the rotation of vehicle wheels or of [[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&nbsp;-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==
 
===Unsigned fraction of turn===
 
In this system, an angle is represented by an ''n''-[[bit]] unsigned binary number in the sequence 0, ..., 2<sup>''n''</sup>−1 that is interpreted as an multiple of 1/2<sup>''n''</sup> of a full turn; that is, 360/2<sup>''n''</sup> degrees or 2π/2<sup>''n''</sup> radians. The number can also be interpreted as a fraction of a full turn between 0 (inclusive) and 1 (exclusive) represented in binary fixed-point format with a scaling factor of 1/2<sup>''n''</sup>. Multiplying that fraction by 360° or 2π gives the angle in [[degree (angle)|degree]]s in the range 0 to 360, or in [[radian]]s, in the range 0 to 2π, respectively.
 
For example, with ''n'' = 8, the binary integers (00000000)<sub>2</sub> (fraction 0.00), (01000000)<sub>2</sub> (0.25), (10000000)<sub>2</sub> (0.50), and (11000000)<sub>2</sub> (0.75) represent the angular measures 0°, 90°, 180°, and 270°, respectively.
 
The main advantage of this system is that the addition or subtraction of the integer numeric values with the ''n''-bit arithmetic used in most computers produces results that are consistent with the geometry of angles. Namely, the integer result of the operation is automatically reduced [[modular arithmetic|modulo]] 2<sup>''n''</sup>, matching the fact that angles that differ by an integer number of full turns are equivalent. Thus one does not need to explicitly test or handle the wrap-around, as one must do when using other representations (such as number of degrees or radians in floating-point).<ref name="harg2019"/>
 
===Signed fraction of turn===
 
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>.
 
Line 22 ⟶ 21:
 
==See also==
* [[Turn (angle)|Turn]]
* [[Grade (angle)|Grade]], 1/400 of a full turn.
* [[CORDIC]], algorithms for trigonometric functions.
Line 28 ⟶ 26:
 
==References==
{{reflist|refs=
 
<references>
 
<ref name="ship">{{cite web |title=Binary angular measurement |url=http://www.tpub.com/content/fc/14100/css/14100_314.htm |archive-url=https://web.archive.org/web/20091221160257/http://www.tpub.com/content/fc/14100/css/14100_314.htm |archive-date=2009-12-21}}</ref>
 
<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=harg2019"lap2004">{{cite webbook |title=Angles,Real-Time integers,Systems Design and moduloAnalysis arithmetic|chapter=Chapter 7.5.3, Binary Angular Measure |author-first=ShawnPhillip A. |author-last=HargreavesLaPlante |author-linkdate=:pl:Shawn Hargreaves2004 |publisherwebsite=blogswww.msdnglobalspec.com |chapter-url=http://blogswww.msdnglobalspec.com/shawnharreference/archive14722/2010160210/01/04/anglesChapter-integers7-and5-modulo3-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=2019Binary-06Angular-30Measure}}</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=lap2004"para2005">{{cite bookweb |title=Real-TimeHitachi SystemsHM55B DesignCompass andModule Analysis(#29123) |chapterseries=ChapterParallax 7.5.3,Digital BinaryCompass AngularSensor Measure(#29123) |author-firstpublisher=Phillip[[Parallax, AInc. (company)|author-last=LaPlanteParallax, Inc.]] |date=2004May 2005 |website=www.globalspechobbyengineering.com |via=www.parallax.com |chapter-url=http://www.globalspechobbyengineering.com/referencespecs/14722/160210/ChapterPX-729123.pdf |url-5status=dead |archive-3url=https://web.archive.org/web/20110711172521/http://www.hobbyengineering.com/specs/PX-Binary29123.pdf |archive-date=2011-Angular07-Measure11}}</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>
 
</references>
 
 
 
[[Category:Units of plane angle]]