initial version

This commit is contained in:
2016-01-21 11:10:55 +01:00
parent 8818a9b216
commit a7dc0cabbb
21 changed files with 1397 additions and 0 deletions

41
grid/GridPoint.h Executable file
View File

@@ -0,0 +1,41 @@
#ifndef GRIDPOINT_H
#define GRIDPOINT_H
#include <cmath>
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