{{fbdoc item="title" value="Different ways angles are measured"}}----
//Written by RandyKeeling//

This very simple tutorial assumes that you know what an angle is.

There are three commonly used ways to measure the size of an angle:

	- Degrees (deg)
	- Radians (rad)
	- Gradients (grad)

**Degrees**

Most people are familiar with angles measured in degrees. A full circle measures 360?. Parts of a degree are often measured two different ways, degrees decimal and DMS (degree, minute, second).
 
We can always show a degree as we would any decimal number by showing its whole units followed by its fractional portion. For example, 75.23? means that we have 75 degrees and twenty-three hundredths of a degree.

In the DMS system, each degree is made up of 60 minutes (or arcminutes) and is marked with a ` . Each minute is made up of 60 seconds (or arcseconds) and is marked with a `` . So a degree measure might look like this 36? 14` 52``. This is read as 36 degrees, 14 minutes, 52 seconds. 

To convert DMS to decimal degrees you can use the following code.

##%%(freebasic)
DIM D AS INTEGER
DIM M AS INTEGER
DIM S AS INTEGER
DIM DD AS SINGLE

'' Convert to degree decimal
DD = D + M / 60 + S / 3600	'' 3600 comes from 1/60 * 1/60
%%##

**Radians**

Radians are more common in computer programming and mathematics. To understand radians, you must understand the constant Pi (often given the symbol of the lowercase Greek letter pi). Pi is an irrational and transcendental number (its decimal notation never ends) and is the circumference of any circle divided by that circle's diameter. An approximate value (to 20 decimal places) is Pi = 3.1415926535897932385. The value of Pi can also be found using this code.

##%%(freebasic)
Pi = 4 * ATN ( 1 )
%%##

With the radian system, a full circle has 2*Pi (6.2831853071795864770) radians. Unlike degrees, radians are ****not**** marked with any form of a symbol. FreeBASIC, like most programming languages, accepts angle measurements in radians and ****not**** degrees.

To convert between radians and degrees (decimal) you can use the following code.

##%%(freebasic)
CONST PI AS DOUBLE = 3.1415926535897932

DIM D AS DOUBLE
DIM R AS DOUBLE

R = D * PI / 180	'' A full circle has 360 degrees, and a full circle has 2*PI Radians
D = R * 180 / PI
%%##

The value of PI is used so often, it is not uncommon to find it defined in libraries and commonly used routines. The following are useful constants.

##%%(freebasic)
CONST PI AS DOUBLE = 3.1415926535897932
CONST TWO_PI AS DOUBLE = 6.283185307179586
CONST HALF_PI AS DOUBLE = 1.570796326794896
CONST DegToRAD AS DOUBLE = 0.01745329251994330	'' PI/180
CONST RADToDeg AS DOUBLE = 57.29577951308233	  '' 180/PI
%%##

**Gradients**

Gradients are used mainly in some forms of engineering. Within the gradient system a circle has 400 grads.

//Last reviewed by ""sancho3"" on February 08, 2018//
