#ifndef __BASE_DATA__ #define __BASE_DATA__ #include #include #include #include #include struct point_2 { double x_; double y_; point_2() :x_(0x12345678) ,y_(0x87654321) { } point_2(double x,double y) :x_(x),y_(y) {} void setX(double x) { x_ = x; } void setY(double y) { y_ = y; } static inline bool is_valid(const point_2&p) { const point_2 &pt=invalid_point(); return pt.x_!=p.x_ || pt.y_!=p.y_; } static inline const point_2& invalid_point() { static const point_2 pt; return pt; } static inline double sqr(double x) { return x*x; } double dist_to(double x,double y) { return std::sqrt(sqr(x-x_)+sqr(y-y_)); } double dist_to(const point_2&pt) { return dist_to(pt.x_,pt.y_); } }; struct st_coord :point_2 { uint64_t gen_time_; uint16_t m_ct;//ct void clear() { gen_time_ = 0; m_ct = 0; x_ = 0; y_ = 0; } void setTime(uint64_t t) { gen_time_ = t; } void setCT(uint16_t t) { m_ct = t; } }; #endif