Cyclone | Cyclone: C:/data/physeng_code/include/cyclone/pcontacts.h Source File |
00001 /* 00002 * Interface file for the contact resolution system for particles. 00003 * 00004 * Part of the Cyclone physics system. 00005 * 00006 * Copyright (c) Icosagon 2003. All Rights Reserved. 00007 * 00008 * This software is distributed under licence. Use of this software 00009 * implies agreement with all terms and conditions of the accompanying 00010 * software licence. 00011 */ 00012 00024 #ifndef CYCLONE_PCONTACTS_H 00025 #define CYCLONE_PCONTACTS_H 00026 00027 #include "particle.h" 00028 00029 namespace cyclone { 00030 00031 /* 00032 * Forward declaration, see full declaration below for complete 00033 * documentation. 00034 */ 00035 class ParticleContactResolver; 00036 00038 00048 00049 class ParticleContact 00050 { 00053 // ... Other ParticleContact code as before ... 00054 00056 00061 friend ParticleContactResolver; 00062 00063 00065 public: 00070 Particle* particle[2]; 00071 00075 real restitution; 00076 00080 Vector3 contactNormal; 00082 00084 00087 real penetration; 00089 00094 Vector3 particleMovement[2]; 00095 00097 protected: 00101 void resolve(real duration); 00102 00106 real calculateSeparatingVelocity() const; 00107 00108 private: 00112 void resolveVelocity(real duration); 00114 00116 00119 void resolveInterpenetration(real duration); 00121 00123 }; 00125 00127 00131 class ParticleContactResolver 00132 { 00133 protected: 00137 unsigned iterations; 00138 00143 unsigned iterationsUsed; 00144 00145 public: 00149 ParticleContactResolver(unsigned iterations); 00150 00154 void setIterations(unsigned iterations); 00155 00160 00186 00187 void resolveContacts(ParticleContact *contactArray, 00188 unsigned numContacts, 00189 real duration); 00190 }; 00192 00194 00198 class ParticleContactGenerator 00199 { 00200 public: 00209 virtual unsigned addContact(ParticleContact *contact, 00210 unsigned limit) const = 0; 00211 }; 00212 00213 00215 00216 } // namespace cyclone 00217 00218 #endif // CYCLONE_CONTACTS_H
© 2000-2003 Icosagon. All Rights Reserved.
Distributed under licence.
Cyclone Version 2.0.5 (Documentation generated Fri Nov 10 20:44:13 2006). |