**Casio fx-CG50 and HP Prime: Azimuth/Bearing Conversions**

**Introduction**

The programs A2B (Azimuth to Bearing) and B2A (Bearing to Azimuth) convert angles between two measuring systems that are commonly used by civil engineers and navigators.

The program uses an unusual approach: the use of the arcsine, sine, and cosine functions. These functions are used on because on scientific calculators, the trigonometric functions return answers in specific ranges.

Let x be a real number. then:

asin(x) returns answers in the range -90° to 90° (-π/2 to π/2 radians)

acos(x) returns answers in the range 0° to 180° (0 to π radians)

atan(x) returns answers in the range -90° to 90° (-π/2 to π/2 radians)

This was used in the HP 33E program from the calculator book "HP 33E: Surveying Applications". See Source below.

Formulas:

A = azimuth

B = bearing

Q = quadrant (1,2,3,4)

Azimuth to Bearing:

B = abs( asin( sin A ) )

Q = int(A/90 + 1)

(Yes, the asin/sin is there for a purpose: to get an angle in the range of -90° to 90°)

Bearing to Azimuth:

A = 180° * int(Q/2) - B * cos(Q * 180°)

In the programs A2B and B2A, both input and output will be degrees-minutes-seconds format.

To enter degrees-minutes-seconds:

Casio fx-CG50: [ OPTN ] [ F6 ] (more) [ F5 ] (ANGLE) [ F4 ] (° ' ")

HP Prime: [ Shift ] [ a b/c ] or [ Shift ] [ 9 ] (select °, ', or '' from the menu)

**Azimuth to Bearing Program A2B**

**Casio fx-CG50 Program A2B (Azimuth to Bearing)**

ClrText

Locate 1,4,"AZIMUTH TO BEARING"

Deg

"AZ: "? → A

Abs( sin^-1 ( sin A ) ) → B

"BEARING ="

B ▶ DMS ◢

Intg( A ÷ 90 + 1 ) → Q

"QUADRANT = "

Q = 1 ⇒ "NE"

Q = 2 ⇒ "SE"

Q = 3 ⇒ "SW"

Q = 4 ⇒ "NW"

**HP Prime Program A2B (Azimuth to Bearing)**

EXPORT A2B(A)

BEGIN

// Azimuth to Bearing

HAngle:=1; // Degrees

LOCAL B, Q, L0:={"NE","SE","SW","NW"};

B:=ABS(ASIN(SIN(A)));

Q:=IP(A/90+1);

RETURN { →HMS(B), L0(Q) }

END;

Example 1: 220° 15' 36"

Result: 40°15'36". SW

Example 2: 184°00'14"

Result: 4°00'14" SW

**Bearing to Azimuth Program B2A**

**Casio fx-CG50 Program B2A (Bearing to Azimuth)**

ClrText

Locate 1,4,"BEARING TO AZIMUTH"

Deg

"BEARING: "? → B

Menu "QUADRANT", "NE", 1, "SE", 2, "SW", 3, "NW", 4

Lbl 1: 1 → Q: Goto 5

Lbl 2: 2 → Q: Goto 5

Lbl 3: 3 → Q: Goto 5

Lbl 4: 4 → Q: Goto 5

Lbl 5

180 * Intg( Q ÷ 2 ) - B * cos( Q * 180 ) → A

"AZ ="

A ▶ DMS

**HP Prime Program B2A (Bearing to Azimuth)**

Arguments: Bearing, Quadrant. You can enter Quadrant by a string or numerical quadrant. "NE" = 1, "SE" = 2, "SW" = 3, "NW" = 4

EXPORT B2A(B,q)

BEGIN

// Bearing to Azimuth

// q "NE", "SE", "SW", "NW"

// or 1,2,3,4

LOCAL A, L0:={"NE","SE","SW","NW"};

HAngle:=1; // Degrees

// deal with strings

IF TYPE(q)==2 THEN

q:=POS(L0,q);

END;

A:= 180 * IP(q/2) - B * cos(q * 180);

RETURN →HMS(A);

END;

Example 3: 43°21'55" SW (q = 3)

Result: 223°21'55"

Example 4: 13°14'56" SE (q = 2)

Result: 166°45'04"

Source:

Hewlett Packard. "HP33E: Surveying Applications" Hewlett Packard Company. March 1978

Eddie

All original content copyright, © 2011-2019. Edward Shore. Unauthorized use and/or unauthorized distribution for commercial purposes without express and written permission from the author is strictly prohibited. This blog entry may be distributed for noncommercial purposes, provided that full credit is given to the author.

## No comments:

## Post a Comment