Changeset 4375 in orxonox.OLD for orxonox/trunk/src/lib/physics
- Timestamp:
- May 29, 2005, 11:55:57 AM (20 years ago)
- Location:
- orxonox/trunk/src/lib/physics
- Files:
-
- 5 edited
- 2 moved
Legend:
- Unmodified
- Added
- Removed
-
orxonox/trunk/src/lib/physics/Makefile.am
r4338 r4375 32 32 noinst_LIBRARIES = libORXphysics.a 33 33 34 libORXphysics_a_SOURCES = i_physics.cc \34 libORXphysics_a_SOURCES = physics_interface.cc \ 35 35 physics_connection.cc \ 36 36 physics_engine.cc \ … … 40 40 fields/twirl.cc 41 41 42 noinst_HEADERS= i_physics.h \42 noinst_HEADERS= physics_interface.h \ 43 43 physics_connection.h \ 44 44 physics_engine.h \ -
orxonox/trunk/src/lib/physics/Makefile.in
r4338 r4375 54 54 libORXphysics_a_AR = $(AR) $(ARFLAGS) 55 55 libORXphysics_a_LIBADD = 56 am_libORXphysics_a_OBJECTS = i_physics.$(OBJEXT) \56 am_libORXphysics_a_OBJECTS = physics_interface.$(OBJEXT) \ 57 57 physics_connection.$(OBJEXT) physics_engine.$(OBJEXT) \ 58 58 field.$(OBJEXT) gravity.$(OBJEXT) point_gravity.$(OBJEXT) \ … … 63 63 am__depfiles_maybe = depfiles 64 64 @AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/field.Po ./$(DEPDIR)/gravity.Po \ 65 @AMDEP_TRUE@ ./$(DEPDIR)/i_physics.Po \66 65 @AMDEP_TRUE@ ./$(DEPDIR)/physics_connection.Po \ 67 66 @AMDEP_TRUE@ ./$(DEPDIR)/physics_engine.Po \ 67 @AMDEP_TRUE@ ./$(DEPDIR)/physics_interface.Po \ 68 68 @AMDEP_TRUE@ ./$(DEPDIR)/point_gravity.Po ./$(DEPDIR)/twirl.Po 69 69 CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ … … 189 189 AM_CXXFLAGS = -I$(MAINSRCDIR) -I$(MAINSRCDIR)/world_entities -I$(MAINSRCDIR)/story_entities -I$(MAINSRCDIR)/lib -I$(MAINSRCDIR)/lib/coord -I$(MAINSRCDIR)/lib/data -I$(MAINSRCDIR)/lib/graphics -I$(MAINSRCDIR)/lib/graphics/importer -I$(MAINSRCDIR)/lib/graphics/particles -I$(MAINSRCDIR)/lib/gui -I$(MAINSRCDIR)/lib/gui/gui -I$(MAINSRCDIR)/lib/lang -I$(MAINSRCDIR)/lib/util -I$(MAINSRCDIR)/lib/math -I$(MAINSRCDIR)/lib/physics -I$(MAINSRCDIR)/lib/physics/fields -I$(MAINSRCDIR)/lib/tinyxml -I$(MAINSRCDIR)/defs -I$(MAINSRCDIR)/font -I$(MAINSRCDIR)/network -I$(MAINSRCDIR)/glmenu -I$(MAINSRCDIR)/ai -I$(MAINSRCDIR)/util -I$(MAINSRCDIR)/util/animation -I$(MAINSRCDIR)/util/common -I$(MAINSRCDIR)/util/loading -I$(MAINSRCDIR)/util/track -I$(MAINSRCDIR)/subprojects 190 190 noinst_LIBRARIES = libORXphysics.a 191 libORXphysics_a_SOURCES = i_physics.cc \191 libORXphysics_a_SOURCES = physics_interface.cc \ 192 192 physics_connection.cc \ 193 193 physics_engine.cc \ … … 197 197 fields/twirl.cc 198 198 199 noinst_HEADERS = i_physics.h \199 noinst_HEADERS = physics_interface.h \ 200 200 physics_connection.h \ 201 201 physics_engine.h \ … … 254 254 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/field.Po@am__quote@ 255 255 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gravity.Po@am__quote@ 256 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/i_physics.Po@am__quote@257 256 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/physics_connection.Po@am__quote@ 258 257 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/physics_engine.Po@am__quote@ 258 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/physics_interface.Po@am__quote@ 259 259 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/point_gravity.Po@am__quote@ 260 260 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/twirl.Po@am__quote@ -
orxonox/trunk/src/lib/physics/physics_connection.cc
r4338 r4375 19 19 20 20 #include "physics_engine.h" 21 22 #include "field.h" 23 #include "particle_system.h" 24 #include "physics_interface.h" 21 25 22 26 using namespace std; … … 51 55 switch(this->type) 52 56 { 53 case PCON_ IPhysField:57 case PCON_PhysIField: 54 58 55 59 break; … … 60 64 break; 61 65 62 case PCON_ IPhysIPhys:66 case PCON_PhysIPhysI: 63 67 64 68 break; -
orxonox/trunk/src/lib/physics/physics_connection.h
r4338 r4375 7 7 #define _PHYSICS_CONNECTION_H 8 8 9 #include "field.h" 10 #include "particle_system.h" 11 #include "i_physics.h" 9 // Forward Declaration 10 class PhysicsInterface; 11 class ParticleSystem; 12 class Field; 12 13 13 14 //! An enumerator for different ConnectionTypes 14 typedef enum PCON_Type { PCON_ IPhysIPhys= 0,15 PCON_ IPhysField = 1,15 typedef enum PCON_Type { PCON_PhysIPhysI = 0, 16 PCON_PhysIField = 1, 16 17 PCON_ParticlesField = 2 }; 17 18 … … 23 24 24 25 public: 25 PhysicsConnection( IPhysics* partnerOne, IPhysics* partnerTwo);26 PhysicsConnection( IPhysics* subject, Field* field);26 PhysicsConnection(PhysicsInterface* partnerOne, PhysicsInterface* partnerTwo); 27 PhysicsConnection(PhysicsInterface* subject, Field* field); 27 28 PhysicsConnection(ParticleSystem* particleSystem, Field* field); 28 29 … … 34 35 PCON_Type type; //!< What kind of connection this is. 35 36 36 IPhysics* subject;//!< The main Subject of this Connection.37 IPhysics* partner2;//!< The second partner of this Connection.37 PhysicsInterface* subject; //!< The main Subject of this Connection. 38 PhysicsInterface* partner2; //!< The second partner of this Connection. 38 39 39 40 ParticleSystem* particleSystem; //!< A ParticleSystem in this Connection -
orxonox/trunk/src/lib/physics/physics_engine.h
r4338 r4375 10 10 #include "base_object.h" 11 11 #include "physics_connection.h" 12 #include "fields.h"13 12 14 13 // Forward Declaration … … 25 24 void addConnection(PhysicsConnection* connection); 26 25 void removeConnection(PhysicsConnection* connection); 26 27 27 28 28 29 void tick(float dt); -
orxonox/trunk/src/lib/physics/physics_interface.cc
r4371 r4375 13 13 ### File Specific: 14 14 main-programmer: Patrick Boenzli 15 co-programmer: ... 15 co-programmer: Benjamin Grauer 16 17 bensch: renamed the file 16 18 */ 17 19 18 20 #define DEBUG_SPECIAL_MODULE DEBUG_MODULE_PHYSICS 19 21 20 #include " i_physics.h"22 #include "physics_interface.h" 21 23 #include "list.h" 22 24 #include "string.h" … … 29 31 \brief standard constructor 30 32 */ 31 IPhysics::IPhysics()33 PhysicsInterface::PhysicsInterface () 32 34 { 33 this->setClassName (" IPhysics");35 this->setClassName ("PhysicsInterface"); 34 36 this->mass = 0; 35 37 this->massChildren = 0; … … 42 44 43 45 */ 44 IPhysics::~IPhysics()46 PhysicsInterface::~PhysicsInterface () 45 47 { 46 48 // delete what has to be deleted here 47 49 } 48 50 49 void IPhysics::recalcMass()51 void PhysicsInterface::recalcMass() 50 52 { 51 53 float massSum = 0; … … 55 57 while( pn != NULL) 56 58 { 57 // todo: find out if children are IPhysicsin an efficient way58 if (strcmp( pn->getClassName(), " IPhysics")) {59 massSum += (( IPhysics*)pn)->getTotalMass();59 // todo: find out if children are PhysicsInterface in an efficient way 60 if (strcmp( pn->getClassName(), "PhysicsInterface")) { 61 massSum += ((PhysicsInterface*)pn)->getTotalMass(); 60 62 } 61 63 pn = iterator->nextElement(); … … 65 67 if (massSum != this->massChildren ) { 66 68 this->massChildren = massSum; 67 if (strcmp( parent->getClassName(), " IPhysics"))68 (( IPhysics*)parent)->recalcMass();69 if (strcmp( parent->getClassName(), "PhysicsInterface")) 70 ((PhysicsInterface*)parent)->recalcMass(); 69 71 } else { 70 72 this->massChildren = massSum; … … 73 75 74 76 75 void IPhysics::addForce( Vector force )77 void PhysicsInterface::addForce( Vector force ) 76 78 { 77 79 forceSum += force; 78 80 } 79 81 80 void IPhysics::addForce(Vector force, Vector grip)82 void PhysicsInterface::addForce(Vector force, Vector grip) 81 83 { 82 84 // add central force … … 86 88 } 87 89 88 void IPhysics::tick( float dt )90 void PhysicsInterface::tick( float dt ) 89 91 { 90 92 Vector acc = forceSum / ( massChildren + mass ); -
orxonox/trunk/src/lib/physics/physics_interface.h
r4371 r4375 1 1 /*! 2 \file i_physics.h2 \file physics_interface.h 3 3 \brief a physics interface simulating a body with a mass 4 4 */ 5 5 6 #ifndef _ I_PHYSICS_H7 #define _ I_PHYSICS_H6 #ifndef _PHYSICS_INTERFACE_H 7 #define _PHYSICS_INTERFACE_H 8 8 9 9 #include "p_node.h" … … 13 13 here can be some longer description of this class 14 14 */ 15 class IPhysics: public PNode {15 class PhysicsInterface : public PNode { 16 16 17 17 public: 18 IPhysics();19 virtual ~ IPhysics();18 PhysicsInterface(); 19 virtual ~PhysicsInterface(); 20 20 21 21 inline void setMass( float mass ) { this->mass = mass; }; //!< Set the mass of this node … … 38 38 }; 39 39 40 #endif /* _ I_PHYSICS_H */40 #endif /* _PHYSICS_INTERFACE_H */
Note: See TracChangeset
for help on using the changeset viewer.