How to resolve the algorithm Angle difference between two bearings step by step in the Craft Basic programming language
Published on 12 May 2024 09:40 PM
How to resolve the algorithm Angle difference between two bearings step by step in the Craft Basic programming language
Table of Contents
Problem Statement
Finding the angle between two bearings is often confusing.[1]
Find the angle which is the result of the subtraction b2 - b1, where b1 and b2 are the bearings. Input bearings are expressed in the range -180 to +180 degrees. The result is also expressed in the range -180 to +180 degrees.
Compute the angle for the following pairs:
Allow the input bearings to be any (finite) value.
Let's start with the solution:
Step by Step solution about How to resolve the algorithm Angle difference between two bearings step by step in the Craft Basic programming language
Source code in the craft programming language
precision 4
define s1 = 0, s2 = 0
dim b1[20, -45, -85, -95, -45, -45, 29.4803, -78.3251]
dim b2[45, 45, 90, 90, 125, 145, -88.6381, -159.036]
arraysize s1, b1
arraysize s2, b2
if s1 = s2 then
for i = 0 to s1 - 1
let r = (b2[i] - b1[i]) % 360
if r >= 180 then
let r = r - 360
endif
print "bearing 1: ", b1[i], " bearing 2: ", b2[i], " difference: ", r
next i
endif
You may also check:How to resolve the algorithm Rot-13 step by step in the Elixir programming language
You may also check:How to resolve the algorithm Optional parameters step by step in the jq programming language
You may also check:How to resolve the algorithm Count in factors step by step in the AutoHotkey programming language
You may also check:How to resolve the algorithm Convert decimal number to rational step by step in the C programming language
You may also check:How to resolve the algorithm URL parser step by step in the Raku programming language