(35S) Azimuth to Bearing/Quadrant and vice-versa
|
11-06-2017, 10:57 PM
Post: #1
|
|||
|
|||
(35S) Azimuth to Bearing/Quadrant and vice-versa
The following program will convert Azimuths to a Bearing/Quadrant format and vice versa. The quadrants are numbered from 1 to 4 starting in the north east and working clockwise.
Code:
After executing the program BEARING will be displayed. At this point enter the bearing to be converted in H.P. notation(dd.mmsss) followed by R/S. If a bearing was entered then QUADRANT will be displayed, enter the quadrant followed by R/S. The display will now show the azimuth in H.P. notation on the X register. Pressing R/S at this point will display BEARING. If no bearing is entered or, a bearing of 3.14159265359 is entered the program will display AZIMUTH. Enter the azimuth to be converted in H.P. notation and press R/S. The display will now show the bearing in H.P. notation on the Y register and the quadrant on the X register. At this point if R/S is pressed the display will show AZIMUTH. If no azimuth was entered, or an azimuth of 3.14159265359 was entered the program will display BEARING. Pressing R/S and not entering anything in will switch between BEARING and AZIMUTH. The variables used by this program are: A, stores the azimuth in decimal degrees. B, stores the bearing in decimal degrees. Q, stores the quadrant number 1-4 where 1 is north east, 2 is south east, 3 is south west, and 4 is north west. To take a bearing and quadrant and convert it to an azimuth: For the north-east quadrant, the bearing is the azimuth. For the south-east quadrant, the bearing needs to be subtracted from 180 to obtain the azimuth. For the south west quadrant, the bearing must be added to 180 to obtain the azimuth. For the north-west quadrant, the bearing must be subtracted from 360 to obtain the azimuth. First the quadrant is divided by 2 and the integer portion multiplied by 180. This will produce either a 0, 180, 180, or 360 depending on the quadrant. Then the cosine of the quadrant multiplied by 180 is taken which will produce either +1 or -1. This is multiplied by the baring which makes it negative for the north-west and south-east quadrants or positive for the north-east and south-west quadrants. The result is then added to the first step to produce the azimuth. To convert an azimuth to a bearing and quadrant is a little easier. First the integer portion of the azimuth is divided by 90 and the integer portion taken. The result is added to 1 to obtain the quadrant. Then the arcsine of the sine of the azimuth is taken of which the absolute value is the bearing. |
|||
11-07-2017, 12:58 AM
Post: #2
|
|||
|
|||
RE: (35S) Azimuth to Bearing/Quadrant and vice-versa
(11-06-2017 10:57 PM)JeremyBeck Wrote: The following program will convert Azimuths to a Bearing/Quadrant format and vice versa. The quadrants are numbered from 1 to 4 starting in the north east and working clockwise. Jeremy, very interestig. Could you please include some examples to test how the program solves? TYVM, Pedro |
|||
11-07-2017, 04:54 PM
Post: #3
|
|||
|
|||
RE: (35S) Azimuth to Bearing/Quadrant and vice-versa
(11-07-2017 12:58 AM)PedroLeiva Wrote:(11-06-2017 10:57 PM)JeremyBeck Wrote: The following program will convert Azimuths to a Bearing/Quadrant format and vice versa. The quadrants are numbered from 1 to 4 starting in the north east and working clockwise. I've attached a PDF of some test examples (one for each quadrant) |
|||
11-08-2017, 12:50 PM
Post: #4
|
|||
|
|||
RE: (35S) Azimuth to Bearing/Quadrant and vice-versa
(11-07-2017 04:54 PM)JeremyBeck Wrote:(11-07-2017 12:58 AM)PedroLeiva Wrote: Jeremy, very interestig. Could you please include some examples to test how the program solves? TYVM, Pedro I like very much the way you have presented the examples, thank you. I would suggest to combine this procedure for the calculation of angles in a poligonal, by azimuts differences (maybe with a routine for another program). Is that posible? Pedro |
|||
11-08-2017, 06:56 PM
(This post was last modified: 11-08-2017 07:06 PM by Dieter.)
Post: #5
|
|||
|
|||
RE: (35S) Azimuth to Bearing/Quadrant and vice-versa
(11-06-2017 10:57 PM)JeremyBeck Wrote: The following program will convert Azimuths to a Bearing/Quadrant format and vice versa. The quadrants are numbered from 1 to 4 starting in the north east and working clockwise. I admit I don't know anything about azimuths and bearings, but I noticed that your program uses a quite creative way of checking whether something has been entered or not. This is done by storing pi in X and Y, and after the prompt the program checks whether X and Y are equal. I would like to suggest another method. The user enters either bearing and quadrant or an azimuth. Since all values are positive (or at least not negative) the sign of the user input may be used to distinguish whether the one or the other has been entered. Also bearing and quadrant may be entered simultaneously, e.g. with bearing [ENTER] quadrant. A negative quadrant then can be used as a marker. See below for some examples. Here is a program that implements this idea, using the same formulas as yours (but without any variables). I was not sure what the IP in your line B036 is for, so it was simply omitted. #-) Code: B001 LBL B The user enters either bearing and a negative (!) quadrant, or an azimuth. Example: convert an azimuth of 103°22'35" to bearing and quadrant, and vice versa. Then convert a bearing of 60° in quadrant 2 to the equivalent azimuth. Code: [XEQ] B [ENTER] => BRG^-Q OR AZIM So you don't have to answer several prompts and the result also has a marker that identifies the quadrant number with a minus sign. BTW, the idea with the negative sign may also be applied to your program. Instead of 2x pi the program may simply have -1 in X before the prompt. Since the user will not enter any negative data, a following x<0? test will determine whether something has been entered or not. Dieter |
|||
11-09-2017, 03:42 PM
Post: #6
|
|||
|
|||
RE: (35S) Azimuth to Bearing/Quadrant and vice-versa
(11-08-2017 06:56 PM)Dieter Wrote: I admit I don't know anything about azimuths and bearings, but I noticed that your program uses a quite creative way of checking whether something has been entered or not. This is done by storing pi in X and Y, and after the prompt the program checks whether X and Y are equal. I was originally using X=0? to test if a user entered anything in or not but I ran across multiple instances where I needed to enter a 0. that is when I thought of using π. Even if I needed to type in π I would not be carrying it out as may places as does the calculator. (11-08-2017 06:56 PM)Dieter Wrote: I would like to suggest another method. The user enters either bearing and quadrant or an azimuth. Since all values are positive (or at least not negative) the sign of the user input may be used to distinguish whether the one or the other has been entered. Also bearing and quadrant may be entered simultaneously, e.g. with bearing [ENTER] quadrant. A negative quadrant then can be used as a marker. See below for some examples. I do like your idea of using a negative quadrant. I never thought of that. I may be changing the program I have now. Being able to enter the number then executing the program and not having any prompts will save on memory and time for sure. |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 2 Guest(s)