# Boost C++ Libraries

...one of the most highly regarded and expertly designed C++ library projects in the world.

##### azimuth (with strategy)

Calculate azimuth of a segment defined by a pair of points.

###### Synopsis

```template<typename Point1, typename Point2, typename Strategy>
auto azimuth(Point1 const & point1, Point2 const & point2, Strategy const & strategy)```

###### Parameters

Type

Concept

Name

Description

Point1 const &

Type of the first point of a segment.

point1

First point of a segment.

Point2 const &

Type of the second point of a segment.

point2

Second point of a segment.

Strategy const &

Type of an umbrella strategy defining azimuth strategy.

strategy

Umbrella strategy defining azimuth strategy.

###### Returns

Either

`#include <boost/geometry.hpp>`

Or

`#include <boost/geometry/algorithms/azimuth.hpp>`

###### Conformance

The function azimuth is not defined by OGC.

Note PostGIS contains an algorithm ST_Azimuth with the same functionality. See the PostGIS documentation.
###### Behavior

The algorithm calculates the azimuth of a segment defined by a pair of points.

Note The result is in radians.
###### Example

Shows how to calculate azimuth in geographic coordinate system

```#include <iostream>

#include <boost/geometry.hpp>
#include <boost/geometry/geometries/point.hpp>

int main()
{
namespace bg = boost::geometry;
typedef bg::model::point<double, 2, bg::cs::geographic<bg::degree> > point_type;

point_type p1(0, 0);
point_type p2(1, 1);

bg::srs::spheroid<double> spheroid(6378137.0, 6356752.3142451793);
bg::strategies::azimuth::geographic<> strategy(spheroid);

auto azimuth = boost::geometry::azimuth(p1, p2, strategy);

std::cout << "azimuth: " << azimuth << std::endl;

return 0;
}
```

Output:

```azimuth: 0.788674
```