Map Matching
point.h
Go to the documentation of this file.
1 #ifndef POINT_H
2 #define POINT_H
3 
4 #include <iostream>
5 #include <vector>
14 #define EPS 1e-12
15 
20 class Point {
21 public:
22  Point() {} // should never be used !!
23 
29  Point(double x, double y)
30  : m_x(x)
31  , m_y(y)
32  {
33  }
37  virtual ~Point() {}
38 
44  bool samePointAs(const Point& p) const;
45 
51  double distanceToPoint(const Point& p) const;
52 
53  std::vector<double> projectionOnSegment(const Point& a, const Point& b) const;
54 
61  double distanceToSegment(const Point& p1, const Point& p2) const;
62 
63  virtual std::string infos() const;
64 
69  double x() const;
70  void setx(double x);
71  double y() const;
72  void sety(double y);
74 
80  double x(int dim) const;
81  void setx(int dim, double value);
83 protected:
88  double m_x;
89  double m_y;
91 
92  static const double POINT_RADIUS;
93 };
94 
95 #endif // POINT_H
double distanceToSegment(const Point &p1, const Point &p2) const
Compute the distance between a point and a segment.
Definition: point.cpp:32
double m_y
Definition: point.h:89
void setx(double x)
Definition: point.cpp:80
Point(double x, double y)
Constructor for GPS points.
Definition: point.h:29
bool samePointAs(const Point &p) const
Check if two points share the same coordinates.
Definition: point.cpp:9
void sety(double y)
Definition: point.cpp:57
static const double POINT_RADIUS
Definition: point.h:92
double y() const
Definition: point.cpp:52
double x() const
Definition: point.cpp:75
virtual ~Point()
Point Class&#39;s Destructor.
Definition: point.h:37
virtual std::string infos() const
Definition: point.cpp:45
double distanceToPoint(const Point &p) const
Calculate distance between two points.
Definition: point.cpp:14
double m_x
Definition: point.h:88
Point()
Definition: point.h:22
std::vector< double > projectionOnSegment(const Point &a, const Point &b) const
Definition: point.cpp:19
The Point class.
Definition: point.h:20