/* Danger from the Deep - Open source submarine simulation Copyright (C) 2003-2006 Thorsten Jordan, Luis Barrancos and others. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ // (physics) physics formulas // subsim (C)+(W) SEE LICENSE #ifndef PHYSICSMGR_H #define PHYSICSMGR_H /* This class contains all physics transformations used in position calculations, balistics, buoyance, etc. */ #include "error.h" #include "vector3.h" #include #define GRAVITY 9.80665 // m/s2, global constant. *MUST BE A DEFINE FOR EASE OF USE* ///\brief contains all math transformations class math { public: // Floating-Point static const double DELTA; // For IS_ZERO static bool IS_ZERO (double value); // Statistics static double average (std::vector& values); static double weighted_average (std::vector& values, std::vector& weights); }; ///\brief contains all physics transformations class physics { public: // Motion static void new_position(vector3& position, vector3& velocity, vector3& acceleration, double delta); static void new_velocity(vector3& velocity, vector3& acceleration, double delta); // Forces static vector3 net_force(std::vector& forces); // Densities static double net_density (std::vector& density, std::vector& occupacy); }; #endif