I'm playing with boost geometry (1.74) and there are a lot of examples using the distance
algorithm which is great. How ever I'm struggling to find an example for calculating the angle (bearing) between two points.
It looks like the atan2 function is used inside details/azimuth.hpp but is not exposed on the API as at the same level the distance algorithm is.
So my question is, how does one use boost geometry to calculate the angle between two points?
Thanks in advance.
Brian
You are quite right about the atan2
function in details/azimuth.hpp
.
The angle (bearing) between two points is often called the azimuth.
It is defined in the file: <boost/geometry/algorithms/detail/azimuth.hpp>
that you refer to, but unfortunately it is not listed in the documentation for boost algorithms.
You should be able to call it like distance
here: https://www.boost.org/doc/libs/1_74_0/libs/geometry/doc/html/geometry/quickstart.html
However, because it's defined in the detail
namespace you may have to use the boost::geometry::detail
namespace or call it explicitly, e.g.:
auto bearing = boost::geometry::detail::azimuth<double>(a, b);