Skip to content

Commit 612ca82

Browse files
committed
Fix formatting
1 parent 1215062 commit 612ca82

File tree

2 files changed

+31
-33
lines changed

2 files changed

+31
-33
lines changed

include/util/cheap_ruler.hpp

Lines changed: 29 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -7,41 +7,41 @@
77
#include <tuple>
88
#include <utility>
99

10-
namespace mapbox {
10+
namespace mapbox
11+
{
1112

12-
namespace geometry {
13-
template <typename T>
14-
struct point
15-
{
16-
using coordinate_type = T;
13+
namespace geometry
14+
{
15+
template <typename T> struct point
16+
{
17+
using coordinate_type = T;
1718

18-
constexpr point()
19-
: x(), y()
20-
{}
21-
constexpr point(T x_, T y_)
22-
: x(x_), y(y_)
23-
{}
19+
constexpr point() : x(), y() {}
20+
constexpr point(T x_, T y_) : x(x_), y(y_) {}
2421

25-
T x;
26-
T y;
27-
};
28-
}
22+
T x;
23+
T y;
24+
};
25+
} // namespace geometry
2926

30-
namespace cheap_ruler {
27+
namespace cheap_ruler
28+
{
3129

32-
using point = geometry::point<double>;
30+
using point = geometry::point<double>;
3331

34-
class CheapRuler {
32+
class CheapRuler
33+
{
3534

3635
// Values that define WGS84 ellipsoid model of the Earth
37-
static constexpr double RE = 6378.137; // equatorial radius
36+
static constexpr double RE = 6378.137; // equatorial radius
3837
static constexpr double FE = 1.0 / 298.257223563; // flattening
3938

4039
static constexpr double E2 = FE * (2 - FE);
4140
static constexpr double RAD = M_PI / 180.0;
4241

43-
public:
44-
explicit CheapRuler(double latitude) {
42+
public:
43+
explicit CheapRuler(double latitude)
44+
{
4545
// Curvature formulas from https://en.wikipedia.org/wiki/Earth_radius#Meridional
4646
double mul = RAD * RE * 1000;
4747
double coslat = std::cos(latitude * RAD);
@@ -53,7 +53,8 @@ class CheapRuler {
5353
ky = mul * w * w2 * (1 - E2); // based on meridonal radius of curvature
5454
}
5555

56-
double squareDistance(point a, point b) const {
56+
double squareDistance(point a, point b) const
57+
{
5758
auto dx = longDiff(a.x, b.x) * kx;
5859
auto dy = (a.y - b.y) * ky;
5960
return dx * dx + dy * dy;
@@ -62,26 +63,23 @@ class CheapRuler {
6263
//
6364
// Given two points of the form [x = longitude, y = latitude], returns the distance.
6465
//
65-
double distance(point a, point b) const {
66-
return std::sqrt(squareDistance(a, b));
67-
}
66+
double distance(point a, point b) const { return std::sqrt(squareDistance(a, b)); }
6867

6968
//
7069
// Returns the bearing between two points in angles.
7170
//
72-
double bearing(point a, point b) const {
71+
double bearing(point a, point b) const
72+
{
7373
auto dx = longDiff(b.x, a.x) * kx;
7474
auto dy = (b.y - a.y) * ky;
7575

7676
return std::atan2(dx, dy) / RAD;
7777
}
7878

79-
private:
79+
private:
8080
double ky;
8181
double kx;
82-
static double longDiff(double a, double b) {
83-
return std::remainder(a - b, 360);
84-
}
82+
static double longDiff(double a, double b) { return std::remainder(a - b, 360); }
8583
};
8684

8785
} // namespace cheap_ruler

src/util/coordinate_calculation.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ class CheapRulerContainer
3030
{
3131
for (int n = 0; n < number_of_rulers; n++)
3232
{
33-
cheap_ruler_cache[n] = mapbox::cheap_ruler::CheapRuler(
34-
step * (n + 0.5) / COORDINATE_PRECISION);
33+
cheap_ruler_cache[n] =
34+
mapbox::cheap_ruler::CheapRuler(step * (n + 0.5) / COORDINATE_PRECISION);
3535
}
3636
};
3737

0 commit comments

Comments
 (0)