%%HP: T(3)A(D)F(.);

@ Program to convert
@ delta Eastings & Northings
@ to angle/bearing and distance
@ Delta Easting must be on level 2 of the stack
@ Delta Northing must be on level 1 of the stack
@ R\->P converts this stack to Bearing & Distance
@ Bearing in DMS is returned on level 2 of the stack
@ Distance is returned on level 1 of the stack

@ Rename this program R\->P on the HP48

\<<

@ Ensure degrees mode is set
DEG

@ Swap stack
SWAP 

@ Set calculator in rectangular mode
RECT

@ Create 2D vector of Delta N & Delta E
\->V2

@ Set calculator in Polar mode
@ this converts delta easting & northing
@ to bearing & distance 
CYLIN

@ Return vector to stack
V\->

@ Convert negative bearings into 
@ 0 - 360 degree format
DUP
IF 0 < THEN 360 + END

@ Convert bearing to DMS format
\->HMS

@ Swap stack
SWAP

@ Bearing on level 2
@ Distance displayed on level 1

@ Return calculator to Rectangular mode
RECT
\>>



