00001 /* 00002 Autor: $Author: kunkel $ State: $State: Exp $ 00003 Datum: $Date: 2005/05/30 12:35:25 $ 00004 Version: $Revision: 1.1 $ 00005 */ 00006 00012 #ifndef PHYSIKENGINE_H 00013 #define PHYSIKENGINE_H 00014 00015 #include <math.h> 00016 #include "Vector.h" 00017 00018 /* 00019 ** 00020 * Matrix-Klasse, mit einigen Matrixoperationen. Wurde in unserer Implementierung 00021 * letztendlich nicht benoetigt. 00022 00023 class Matrix { 00024 public: 00025 double x1, x2, x3, y1, y2, y3, z1, z2, z3; 00026 inline Matrix(double x1_, double x2_, double x3_, double y1_, double y2_, 00027 double y3_, double z1_, double z2_, double z3_) { 00028 x1=x1_; 00029 x2=x2_; 00030 x3=x3_; 00031 y1=y1_; 00032 y2=y2_; 00033 y3=y3_; 00034 z1=z1_; 00035 z2=z2_; 00036 z3=z3_; 00037 } 00038 inline Matrix() {} 00039 00040 inline Matrix operator*(const Matrix & a) { 00041 return Matrix( x1 * a.x1 + x2 * a.y1 + x3 * a.z1, 00042 x1 * a.x2 + x2 * a.y2 + x3 * a.z2, 00043 x1 * a.x3 + x2 * a.y3 + x3 * a.z3, 00044 y1 * a.x1 + y2 * a.y1 + y3 * a.z1, 00045 y1 * a.x2 + y2 * a.y2 + y3 * a.z2, 00046 y1 * a.x3 + y2 * a.y3 + y3 * a.z3, 00047 z1 * a.x1 + z2 * a.y1 + z3 * a.z1, 00048 z1 * a.x2 + z2 * a.y2 + z3 * a.z2, 00049 z1 * a.x3 + z2 * a.y3 + z3 * a.z3 00050 ); 00051 } 00052 00053 inline Vector operator*(const vector & a) { 00054 return Vector(x1 * a.x + x2 * a.y + x3 * a.z, y1 * a.x + y2 * a.y + y3 * 00055 a.z, z1 * a.x + z2 * a.y + z3 * a.z); 00056 } 00057 00058 00059 }; 00060 00061 inline ostream & operator<<(ostream &out_, const matrix & v_){ 00062 out_ << " X1: " << v_.x1 00063 << " X2: " << v_.x2 00064 << " X3: " << v_.x3 00065 << " Y1: " << v_.y1 00066 << " Y2: " << v_.y2 00067 << " Y3: " << v_.y3 00068 << " Z1: " << v_.z1 00069 << " Z2: " << v_.z2 00070 << " Z3: " << v_.z3; 00071 return out_; 00072 } 00073 */ 00074 00081 class PhysikEngine { 00082 /*private: 00083 // diese Funktiont wird fuer die Ephemeriden-Funktion unten benoetigt 00084 static double rtnewt(double x1, double x2, double xacc, double M, 00085 double epsilon);*/ 00086 00087 public: 00088 static void simulateGravity(double time); 00089 00090 /* Die folgende Ephemeriden-Funktion wurde aus datentechnischen 00091 Gruenden nie getestet/fertiggestellt, koennte aber als Geruest fuer 00092 ein ephemeridenbasiertes Koordinatensystem verwendet werden.*/ 00093 // static Vector getPositionFromEphemeris(double acc_, double a_, 00094 // double epsilon_, double i, double Omega, double omega, double M_, 00095 // bool grad); 00096 00097 Vector getSpeed(); 00098 00102 class Error { 00103 private: 00107 string message; 00108 00109 public: 00114 Error(const string & msg) { 00115 message = msg; 00116 } 00117 00121 void print() { 00122 cerr << message << endl; 00123 } 00124 }; 00125 }; 00126 00127 #endif