#ifndef GRIDPOINT_H #define GRIDPOINT_H #include struct GridPoint { /** x-position (in centimeter) */ const float x_cm; /** y-position (in centimeter) */ const float y_cm; /** z-position (in centimeter) */ const float z_cm; /** empty ctor */ GridPoint() : x_cm(0), y_cm(0), z_cm(0) {;} /** ctor */ GridPoint(const float x_cm, const float y_cm, const float z_cm) : x_cm(x_cm), y_cm(y_cm), z_cm(z_cm) {;} /** equal? */ bool operator == (const GridPoint& o) const { return x_cm == o.x_cm && y_cm == o.y_cm && z_cm == o.z_cm; } /** get the distance (in meter) betwen this and the given point */ float getDistanceInMeter(const GridPoint& other) const { const int dx = x_cm - other.x_cm; const int dy = y_cm - other.y_cm; const int dz = z_cm - other.z_cm; return std::sqrt(dx*dx + dy*dy + dz*dz) / 100.0f; } }; #endif // GRIDPOINT_H