Binary angular measurement

Last updated

Binary angular measurement (BAM) [1] (and the binary angular measurement system, BAMS [2] ) is a measure of angles using binary numbers and fixed-point arithmetic, in which a half turn is represented by the value 1. The unit of angular measure used in those methods may be called binary radian (brad) or binary degree.

Contents

These representation of angles are often used in numerical control and digital signal processing applications, such as robotics, navigation, [3] computer games, [4] and digital sensors. [5] On the other hand, this system is not adequate for situations where the number of full turns must be measured, e.g. to monitor the rotation of vehicle wheels or of leadscrews.

Binary angle measurement system. Black is traditional degrees representation, green is a BAM as a decimal number and red 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 , representing fractions between -1.0 (inclusive) and +1.0 (exclusive). Binary angles.svg
Binary angle measurement system. Black is traditional degrees representation, green is a BAM as a decimal number and red 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 , 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, ..., 2n−1 that is interpreted as a multiple of 1/2n of a full turn; that is, 360/2n degrees or 2π/2n 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/2n. Multiplying that fraction by 360° or 2π gives the angle in degrees in the range 0 to 360, or in radians, in the range 0 to 2π, respectively.

For example, with n = 8, the binary integers (00000000)2 (fraction 0.00), (01000000)2 (0.25), (10000000)2 (0.50), and (11000000)2 (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 modulo 2n, 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). [6]

Signed fraction of turn

Alternatively, the same n bits can also be interpreted as a signed integer in the range −2n−1, ..., 2n−1−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/2n−1.

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 [−π, +π] when computing trigonometric functions.

See also

Related Research Articles

<span class="mw-page-title-main">Angle</span> Figure formed by two rays meeting at a common point

In Euclidean geometry, an angle is the figure formed by two rays, called the sides of the angle, sharing a common endpoint, called the vertex of the angle. Angles formed by two rays are also known as plane angles as they lie in the plane that contains the rays. Angles are also formed by the intersection of two planes; these are called dihedral angles. Two intersecting curves may also define an angle, which is the angle of the rays lying tangent to the respective curves at their point of intersection.

<span class="mw-page-title-main">Minute and second of arc</span> Units for measuring angles

A minute of arc, arcminute (arcmin), arc minute, or minute arc, denoted by the symbol , is a unit of angular measurement equal to 1/60 of one degree. Since one degree is 1/360 of a turn, or complete rotation, one arcminute is 1/21600 of a turn. The nautical mile (nmi) was originally defined as the arc length of a minute of latitude on a spherical Earth, so the actual Earth circumference is very near 21600 nmi. A minute of arc is π/10800 of a radian.

<span class="mw-page-title-main">Parsec</span> Unit of length used in astronomy

The parsec is a unit of length used to measure the large distances to astronomical objects outside the Solar System, approximately equal to 3.26 light-years or 206,265 astronomical units (AU), i.e. 30.9 trillion kilometres. The parsec unit is obtained by the use of parallax and trigonometry, and is defined as the distance at which 1 AU subtends an angle of one arcsecond. The nearest star, Proxima Centauri, is about 1.3 parsecs from the Sun: from that distance, the gap between the Earth and the Sun spans slightly less than 1/3600 of one degree of view. Most stars visible to the naked eye are within a few hundred parsecs of the Sun, with the most distant at a few thousand parsecs, and the Andromeda Galaxy at over 700,000 parsecs.

<span class="mw-page-title-main">Phase (waves)</span> The elapsed fraction of a cycle of a periodic function

In physics and mathematics, the phase of a wave or other periodic function of some real variable is an angle-like quantity representing the fraction of the cycle covered up to . It is expressed in such a scale that it varies by one full turn as the variable goes through each period. It may be measured in any angular unit such as degrees or radians, thus increasing by 360° or as the variable completes a full period.

<span class="mw-page-title-main">Radian</span> SI derived unit of angle

The radian, denoted by the symbol rad, is the unit of angle in the International System of Units (SI) and is the standard unit of angular measure used in many areas of mathematics. It is defined such that one radian is the angle subtended at the centre of a circle by an arc that is equal in length to the radius. The unit was formerly an SI supplementary unit and is currently a dimensionless SI derived unit, defined in the SI as 1 rad = 1 and expressed in terms of the SI base unit metre (m) as rad = m/m. Angles without explicitly specified units are generally assumed to be measured in radians, especially in mathematical writing.

Double-precision floating-point format is a floating-point number format, usually occupying 64 bits in computer memory; it represents a wide dynamic range of numeric values by using a floating radix point.

<span class="mw-page-title-main">Angular frequency</span> Rate of change of angle

In physics, angular frequency, also called angular speed and angular rate, is a scalar measure of the angle rate or the temporal rate of change of the phase argument of a sinusoidal waveform or sine function . Angular frequency is the magnitude of the pseudovector quantity angular velocity.

<span class="mw-page-title-main">Gradian</span> Unit of measurement of an angle, equal to 1/400th of a circle

In trigonometry, the gradian – also known as the gon, grad, or grade – is a unit of measurement of an angle, defined as one-hundredth of the right angle; in other words, 100 gradians is equal to 90 degrees. It is equivalent to 1/400 of a turn, 9/10 of a degree, or π/200 of a radian. Measuring angles in gradians is said to employ the centesimal system of angular measurement, initiated as part of metrication and decimalisation efforts.

Two's complement is the most common method of representing signed integers on computers, and more generally, fixed point binary values. Two's complement uses the binary digit with the greatest place value as the sign to indicate whether the binary number is positive or negative. When the most significant bit is 1, the number is signed as negative; and when the most significant bit is 0 the number is signed as positive.

<span class="mw-page-title-main">Power of two</span> Two raised to an integer power

A power of two is a number of the form 2n where n is an integer, that is, the result of exponentiation with number two as the base and integer n as the exponent.

In computing, fixed-point is a method of representing fractional (non-integer) numbers by storing a fixed number of digits of their fractional part. Dollar amounts, for example, are often stored with exactly two fractional digits, representing the cents. More generally, the term may refer to representing fractional values as integer multiples of some fixed small unit, e.g. a fractional amount of hours as an integer multiple of ten-minute intervals. Fixed-point number representation is often contrasted to the more complicated and computationally demanding floating-point representation.

<span class="mw-page-title-main">Rotational frequency</span> Number of rotations per unit time

Rotational frequency, also known as rotational speed or rate of rotation, is the frequency of rotation of an object around an axis. Its SI unit is the reciprocal seconds (s−1); other common units of measurement include the hertz (Hz), cycles per second (cps), and revolutions per minute (rpm).

<span class="mw-page-title-main">Turn (angle)</span> Unit of plane angle where a full circle equals 1

One turn is a unit of plane angle measurement equal to  radians, 360 degrees or 400 gradians. Thus it is the angular measure subtended by a complete circle at its center.

<span class="mw-page-title-main">Mean anomaly</span> Specifies the orbit of an object in space

In celestial mechanics, the mean anomaly is the fraction of an elliptical orbit's period that has elapsed since the orbiting body passed periapsis, expressed as an angle which can be used in calculating the position of that body in the classical two-body problem. It is the angular distance from the pericenter which a fictitious body would have if it moved in a circular orbit, with constant speed, in the same orbital period as the actual body in its elliptical orbit.

<span class="mw-page-title-main">Degree (angle)</span> Unit of plane angle where a full circle equals 360°

A degree, usually denoted by °, is a measurement of a plane angle in which one full rotation is 360 degrees.

<span class="mw-page-title-main">Milliradian</span> Angular measurement, thousandth of a radian

A milliradian is an SI derived unit for angular measurement which is defined as a thousandth of a radian (0.001 radian). Milliradians are used in adjustment of firearm sights by adjusting the angle of the sight compared to the barrel. Milliradians are also used for comparing shot groupings, or to compare the difficulty of hitting different sized shooting targets at different distances. When using a scope with both mrad adjustment and a reticle with mrad markings, the shooter can use the reticle as a ruler to count the number of mrads a shot was off-target, which directly translates to the sight adjustment needed to hit the target with a follow-up shot. Optics with mrad markings in the reticle can also be used to make a range estimation of a known size target, or vice versa, to determine a target size if the distance is known, a practice called "milling".

<span class="mw-page-title-main">Small-angle approximation</span> Simplification of the basic trigonometric functions

The small-angle approximations can be used to approximate the values of the main trigonometric functions, provided that the angle in question is small and is measured in radians:

Many protocols and algorithms require the serialization or enumeration of related entities. For example, a communication protocol must know whether some packet comes "before" or "after" some other packet. The IETF RFC 1982 attempts to define "serial number arithmetic" for the purposes of manipulating and comparing these sequence numbers. In short, when the absolute serial number value decreases by more than half of the maximum value, it is considered to be "after" the former, whereas other decreases are considered to be "before".

<span class="mw-page-title-main">Stadiametric rangefinding</span>

Stadiametric rangefinding, or the stadia method, is a technique of measuring distances with a telescopic instrument. The term stadia comes from a Greek unit of length Stadion which was the typical length of a sports stadium of the time. Stadiametric rangefinding is used for surveying and in the telescopic sights of firearms, artillery pieces, or tank guns, as well as some binoculars and other optics. It is still widely used in long-range military sniping, but in many professional applications it is being replaced with microwave, infrared, or laser rangefinding methods. Although much easier to use, electronic rangefinders can give away the shooter's position to a well-equipped adversary, and the need for accurate range estimation has existed for much longer than electronic rangefinders small and rugged enough to be suitable for military use.

<span class="mw-page-title-main">Sine and cosine</span> Fundamental trigonometric functions

In mathematics, sine and cosine are trigonometric functions of an angle. The sine and cosine of an acute angle are defined in the context of a right triangle: for the specified angle, its sine is the ratio of the length of the side that is opposite that angle to the length of the longest side of the triangle, and the cosine is the ratio of the length of the adjacent leg to that of the hypotenuse. For an angle , the sine and cosine functions are denoted simply as and .

References

  1. "Binary angular measurement". Archived from the original on 2009-12-21.
  2. "Binary Angular Measurement System". acronyms.thefreedictionary.
  3. LaPlante, Phillip A. (2004). "Chapter 7.5.3, Binary Angular Measure". Real-Time Systems Design and Analysis.{{cite book}}: |website= ignored (help)
  4. Sanglard, Fabien (2010-01-13). "Doom 1993 code review - Section "Walls"". fabiensanglard.net.
  5. "Hitachi HM55B Compass Module (#29123)" (PDF). www.hobbyengineering.com. Parallax Digital Compass Sensor (#29123). Parallax, Inc. May 2005. Archived from the original (PDF) on 2011-07-11 via www.parallax.com.
  6. Hargreaves, Shawn [in Polish]. "Angles, integers, and modulo arithmetic". blogs.msdn.com. Archived from the original on 2019-06-30. Retrieved 2019-08-05.