b2_island.h
Go to the documentation of this file.
1 // MIT License
2 
3 // Copyright (c) 2019 Erin Catto
4 
5 // Permission is hereby granted, free of charge, to any person obtaining a copy
6 // of this software and associated documentation files (the "Software"), to deal
7 // in the Software without restriction, including without limitation the rights
8 // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 // copies of the Software, and to permit persons to whom the Software is
10 // furnished to do so, subject to the following conditions:
11 
12 // The above copyright notice and this permission notice shall be included in all
13 // copies or substantial portions of the Software.
14 
15 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 // SOFTWARE.
22 
23 #ifndef B2_ISLAND_H
24 #define B2_ISLAND_H
25 
26 #include "box2d/b2_body.h"
27 #include "box2d/b2_math.h"
28 #include "box2d/b2_time_step.h"
29 
30 class b2Contact;
31 class b2Joint;
32 class b2StackAllocator;
33 class b2ContactListener;
35 struct b2Profile;
36 
38 class b2Island
39 {
40 public:
41  b2Island(int32 bodyCapacity, int32 contactCapacity, int32 jointCapacity,
42  b2StackAllocator* allocator, b2ContactListener* listener);
43  ~b2Island();
44 
45  void Clear()
46  {
47  m_bodyCount = 0;
48  m_contactCount = 0;
49  m_jointCount = 0;
50  }
51 
52  void Solve(b2Profile* profile, const b2TimeStep& step, const b2Vec2& gravity, bool allowSleep);
53 
54  void SolveTOI(const b2TimeStep& subStep, int32 toiIndexA, int32 toiIndexB);
55 
56  void Add(b2Body* body)
57  {
59  body->m_islandIndex = m_bodyCount;
60  m_bodies[m_bodyCount] = body;
61  ++m_bodyCount;
62  }
63 
64  void Add(b2Contact* contact)
65  {
67  m_contacts[m_contactCount++] = contact;
68  }
69 
70  void Add(b2Joint* joint)
71  {
73  m_joints[m_jointCount++] = joint;
74  }
75 
76  void Report(const b2ContactVelocityConstraint* constraints);
77 
80 
84 
87 
91 
95 };
96 
97 #endif
This is an internal class.
Definition: b2_island.h:38
int32 m_islandIndex
Definition: b2_body.h:439
This is an internal structure.
Definition: b2_time_step.h:60
b2Position * m_positions
Definition: b2_island.h:85
b2ContactListener * m_listener
Definition: b2_island.h:79
void Add(b2Joint *joint)
Definition: b2_island.h:70
int32 m_jointCount
Definition: b2_island.h:89
void Report(const b2ContactVelocityConstraint *constraints)
Definition: b2_island.cpp:521
This is an internal structure.
Definition: b2_time_step.h:42
int32 m_contactCapacity
Definition: b2_island.h:93
A 2D column vector.
Definition: b2_math.h:41
void SolveTOI(const b2TimeStep &subStep, int32 toiIndexA, int32 toiIndexB)
Definition: b2_island.cpp:389
signed int int32
Definition: b2_types.h:28
b2Velocity * m_velocities
Definition: b2_island.h:86
int32 m_jointCapacity
Definition: b2_island.h:94
int32 m_bodyCount
Definition: b2_island.h:88
A rigid body. These are created via b2World::CreateBody.
Definition: b2_body.h:128
b2Body ** m_bodies
Definition: b2_island.h:81
b2Contact ** m_contacts
Definition: b2_island.h:82
Profiling data. Times are in milliseconds.
Definition: b2_time_step.h:29
b2StackAllocator * m_allocator
Definition: b2_island.h:78
b2Island(int32 bodyCapacity, int32 contactCapacity, int32 jointCapacity, b2StackAllocator *allocator, b2ContactListener *listener)
Definition: b2_island.cpp:153
unsigned int step
void Add(b2Contact *contact)
Definition: b2_island.h:64
void Clear()
Definition: b2_island.h:45
b2Joint ** m_joints
Definition: b2_island.h:83
void Solve(b2Profile *profile, const b2TimeStep &step, const b2Vec2 &gravity, bool allowSleep)
Definition: b2_island.cpp:188
int32 m_bodyCapacity
Definition: b2_island.h:92
This is an internal structure.
Definition: b2_time_step.h:53
int32 m_contactCount
Definition: b2_island.h:90
void Add(b2Body *body)
Definition: b2_island.h:56
#define b2Assert(A)
Definition: b2_common.h:37


mvsim
Author(s):
autogenerated on Tue Jul 4 2023 03:08:19