Repo created
This commit is contained in:
parent
4af19165ec
commit
68073add76
12458 changed files with 12350765 additions and 2 deletions
44
libs/geometry/latlon.hpp
Normal file
44
libs/geometry/latlon.hpp
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
#pragma once
|
||||
|
||||
#include "base/math.hpp"
|
||||
|
||||
#include <string>
|
||||
|
||||
namespace ms
|
||||
{
|
||||
/// \brief Class for representing WGS point.
|
||||
class LatLon
|
||||
{
|
||||
public:
|
||||
static double constexpr kMinLat = -90.0;
|
||||
static double constexpr kMaxLat = 90.0;
|
||||
static double constexpr kMinLon = -180.0;
|
||||
static double constexpr kMaxLon = 180.0;
|
||||
static double constexpr kInvalid = -1000.0;
|
||||
|
||||
// Default values are invalid.
|
||||
double m_lat = kInvalid;
|
||||
double m_lon = kInvalid;
|
||||
|
||||
constexpr LatLon() = default;
|
||||
constexpr LatLon(double lat, double lon) : m_lat(lat), m_lon(lon) {}
|
||||
|
||||
static constexpr LatLon Invalid() { return LatLon(kInvalid, kInvalid); }
|
||||
static constexpr LatLon Zero() { return LatLon(0.0, 0.0); }
|
||||
|
||||
bool constexpr IsValid() const { return m_lat != kInvalid && m_lon != kInvalid; }
|
||||
bool operator==(LatLon const & rhs) const;
|
||||
bool operator<(LatLon const & rhs) const;
|
||||
|
||||
bool EqualDxDy(LatLon const & p, double eps) const;
|
||||
|
||||
struct Hash
|
||||
{
|
||||
size_t operator()(ms::LatLon const & p) const { return math::Hash(p.m_lat, p.m_lon); }
|
||||
};
|
||||
};
|
||||
|
||||
bool AlmostEqualAbs(LatLon const & ll1, LatLon const & ll2, double eps);
|
||||
|
||||
std::string DebugPrint(LatLon const & t);
|
||||
} // namespace ms
|
||||
Loading…
Add table
Add a link
Reference in a new issue