/* * POS.h * * Created on: 30.11.2010 * Author: istsveise */ #ifndef POS_H_ #define POS_H_ #include #include using namespace std; extern const double PI; struct vector3d { double x; double y; double z; vector3d(double px,double py):x(px),y(py),z(1) {}; vector3d():x(0),y(0),z(1) {}; double length() { return sqrt( (x*x) + (y*y) ); } double scalarProduct(const vector3d& l) { return (x*l.x)+(y*l.y)+(z*l.z); } void crossProduct(const vector3d& l,vector3d& res) { res.x = ( (y*l.z) - (z*l.y) ); res.y = ( (z*l.x) - (x*l.z) ); res.z = ( (x*l.y) - (y*l.x) ); } void normalize() { double len = length(); x = x / len; y = y / len; z = z / len; } }; struct POS { double x; double y; void move(double v, double dir) { // cout << "v: " << v << " dir: " << dir <