I have several compass bearings:

bTrue = 190°
b1 = 250°
b2 = 100°
b3 = 170°
b4 = 90°

I want to compare b1 - b4 and find out how close they are to bTrue. So bTrue is 100%. How much percent is then b1, b2, b3, and b4? 360°-180° would be 0%.

The use case is that have GPS locations with bearings that I am trying to match to road segments, where I also know the bearing. Besides the distance to the road I also want to consider bearing. b1 - b4 are the bearings of the road and bTrue is the bearing of the GPS point.

  • Is the scale linear (so 90° off would be 50%)? Are the bearings all in the range [0...360]? If so, it should just be 1 - abs(bTrue - bx)/180 – BradHards Jan 12 '15 at 20:01

Assuming the scale is linear (i.e. 0° difference between actual and desired is 100%, 90° difference between actual and desired is 50%, 180° difference between actual and desired is 0%) and that the bearings are all in the range 0...360, then you can calculate this with:

1 - abs(bTrue - bx)/180

where bTrue is the desired bearing (course) and bx is one of the candidate options.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.