Changeset 4182 in orxonox.OLD for orxonox/branches/physics/src/util
- Timestamp:
- May 14, 2005, 1:15:25 AM (20 years ago)
- Location:
- orxonox/branches/physics/src/util/physics
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/branches/physics/src/util/physics/physics_connection.cc
r4181 r4182 17 17 18 18 #include "physics_connection.h" 19 19 #include "field.h" 20 #include "particle_system.h" 20 21 21 22 using namespace std; 22 23 23 24 24 /** 25 \brief standard constructor 26 */ 27 PhysicsConnection::PhysicsConnection () 25 26 PhysicsConnection::PhysicsConnection(ParticleSystem* particleSystem, Field* field) 28 27 { 29 this->setClassName ("PhysicsConnection"); 30 connection = NULL; 28 this->type = PCON_ParticlesField; 29 this->particleSystem = particleSystem; 30 this->field = field; 31 31 } 32 32 … … 38 38 PhysicsConnection::~PhysicsConnection () 39 39 { 40 if (this->connection) 41 delete this->connection; 40 42 41 } 43 42 43 /** 44 \brief applies the Force to some Object. 45 */ 46 void PhysicsConnection::apply(void) const 47 { 48 switch(this->type) 49 { 50 case PCON_IPhysField: 51 52 break; 44 53 54 case PCON_ParticlesField: 55 this->particleSystem->applyField(this->field); 45 56 57 break; 58 59 case PCON_IPhysIPhys: 46 60 47 48 49 bool PhysicsConnection::addConnection(ParticleSystem* particleSystem, Field* field) 50 { 51 if (!this->connection) 52 { 53 this->connection = new PhysConnection; 54 this->connection->type = PCON_ParticlesField; 55 this->connection->particleSystem = particleSystem; 56 this->connection->field = field; 61 break; 57 62 } 58 63 } -
orxonox/branches/physics/src/util/physics/physics_connection.h
r4181 r4182 6 6 #ifndef _PHYSICS_CONNECTION_H 7 7 #define _PHYSICS_CONNECTION_H 8 9 #include "base_object.h"10 8 11 9 //! An enumerator for different ConnectionTypes … … 20 18 class ParticleSystem; 21 19 20 //! A class that Handles Physical Connection between subjects 21 class PhysicsConnection { 22 22 23 typedef struct PhysConnection 24 { 23 public: 24 PhysicsConnection(IPhysics* partnerOne, IPhysics* partnerTwo); 25 PhysicsConnection(IPhysics* subject, Field* field); 26 PhysicsConnection(ParticleSystem* particleSystem, Field* field); 27 28 virtual ~PhysicsConnection(); 29 30 void apply(void) const; 31 32 private: 25 33 PCON_Type type; //!< What kind of connection this is. 26 34 27 35 IPhysics* subject; //!< The main Subject of this Connection. 28 36 IPhysics* partner2; //!< The second partner of this Connection. 29 37 30 38 ParticleSystem* particleSystem; //!< A ParticleSystem in this Connection 31 39 … … 33 41 }; 34 42 35 //! A class that Handles Physical Connection between subjects36 class PhysicsConnection : public BaseObject {37 38 public:39 PhysicsConnection();40 virtual ~PhysicsConnection();41 42 bool addConnection(IPhysics* partnerOne, IPhysics* partnerTwo);43 bool addConnection(IPhysics* subject, Field* field);44 bool addConnection(ParticleSystem* particleSystem, Field* field);45 46 inline PhysConnection* getConnection(void) const {return this->connection;}47 48 private:49 PhysConnection* connection; //!< The Physical Connection.50 };51 52 43 #endif /* _PHYSICS_CONNECTION_H */
Note: See TracChangeset
for help on using the changeset viewer.