Warning, file /education/gcompris/external/qml-box2d/Box2D/Dynamics/b2Island.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001 /* 0002 * Copyright (c) 2006-2009 Erin Catto http://www.box2d.org 0003 * 0004 * This software is provided 'as-is', without any express or implied 0005 * warranty. In no event will the authors be held liable for any damages 0006 * arising from the use of this software. 0007 * Permission is granted to anyone to use this software for any purpose, 0008 * including commercial applications, and to alter it and redistribute it 0009 * freely, subject to the following restrictions: 0010 * 1. The origin of this software must not be misrepresented; you must not 0011 * claim that you wrote the original software. If you use this software 0012 * in a product, an acknowledgment in the product documentation would be 0013 * appreciated but is not required. 0014 * 2. Altered source versions must be plainly marked as such, and must not be 0015 * misrepresented as being the original software. 0016 * 3. This notice may not be removed or altered from any source distribution. 0017 */ 0018 0019 #ifndef B2_ISLAND_H 0020 #define B2_ISLAND_H 0021 0022 #include <Box2D/Common/b2Math.h> 0023 #include <Box2D/Dynamics/b2Body.h> 0024 #include <Box2D/Dynamics/b2TimeStep.h> 0025 0026 class b2Contact; 0027 class b2Joint; 0028 class b2StackAllocator; 0029 class b2ContactListener; 0030 struct b2ContactVelocityConstraint; 0031 struct b2Profile; 0032 0033 /// This is an internal class. 0034 class b2Island 0035 { 0036 public: 0037 b2Island(int32 bodyCapacity, int32 contactCapacity, int32 jointCapacity, 0038 b2StackAllocator* allocator, b2ContactListener* listener); 0039 ~b2Island(); 0040 0041 void Clear() 0042 { 0043 m_bodyCount = 0; 0044 m_contactCount = 0; 0045 m_jointCount = 0; 0046 } 0047 0048 void Solve(b2Profile* profile, const b2TimeStep& step, const b2Vec2& gravity, bool allowSleep); 0049 0050 void SolveTOI(const b2TimeStep& subStep, int32 toiIndexA, int32 toiIndexB); 0051 0052 void Add(b2Body* body) 0053 { 0054 b2Assert(m_bodyCount < m_bodyCapacity); 0055 body->m_islandIndex = m_bodyCount; 0056 m_bodies[m_bodyCount] = body; 0057 ++m_bodyCount; 0058 } 0059 0060 void Add(b2Contact* contact) 0061 { 0062 b2Assert(m_contactCount < m_contactCapacity); 0063 m_contacts[m_contactCount++] = contact; 0064 } 0065 0066 void Add(b2Joint* joint) 0067 { 0068 b2Assert(m_jointCount < m_jointCapacity); 0069 m_joints[m_jointCount++] = joint; 0070 } 0071 0072 void Report(const b2ContactVelocityConstraint* constraints); 0073 0074 b2StackAllocator* m_allocator; 0075 b2ContactListener* m_listener; 0076 0077 b2Body** m_bodies; 0078 b2Contact** m_contacts; 0079 b2Joint** m_joints; 0080 0081 b2Position* m_positions; 0082 b2Velocity* m_velocities; 0083 0084 int32 m_bodyCount; 0085 int32 m_jointCount; 0086 int32 m_contactCount; 0087 0088 int32 m_bodyCapacity; 0089 int32 m_contactCapacity; 0090 int32 m_jointCapacity; 0091 }; 0092 0093 #endif