blob: 75f1dfc1b45250a7798b3a072972dfc596e5d8c9 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
#pragma once
#include "common.h"
#include "location.h"
namespace NReverseGeocoder {
struct Y_PACKED TPoint {
TCoordinate X;
TCoordinate Y;
TPoint()
: X(0)
, Y(0)
{
}
TPoint(const TCoordinate& x1, const TCoordinate& y1)
: X(x1)
, Y(y1)
{
}
explicit TPoint(const TLocation& l)
: X(ToCoordinate(l.Lon))
, Y(ToCoordinate(l.Lat))
{
}
TPoint operator-(const TPoint& p) const {
return TPoint(X - p.X, Y - p.Y);
}
bool operator==(const TPoint& b) const {
return X == b.X && Y == b.Y;
}
bool operator!=(const TPoint& b) const {
return X != b.X || Y != b.Y;
}
bool operator<(const TPoint& b) const {
return X < b.X || (X == b.X && Y < b.Y);
}
TSquare Cross(const TPoint& p) const {
return 1ll * X * p.Y - 1ll * Y * p.X;
}
};
static_assert(sizeof(TPoint) == 8, "NReverseGeocoder::TPoint size mismatch");
}
|