externals
box2d
src
dynamics
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
;
34
struct
b2ContactVelocityConstraint
;
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
{
58
b2Assert
(
m_bodyCount
<
m_bodyCapacity
);
59
body->
m_islandIndex
=
m_bodyCount
;
60
m_bodies
[
m_bodyCount
] = body;
61
++
m_bodyCount
;
62
}
63
64
void
Add
(
b2Contact
* contact)
65
{
66
b2Assert
(
m_contactCount
<
m_contactCapacity
);
67
m_contacts
[
m_contactCount
++] = contact;
68
}
69
70
void
Add
(
b2Joint
* joint)
71
{
72
b2Assert
(
m_jointCount
<
m_jointCapacity
);
73
m_joints
[
m_jointCount
++] = joint;
74
}
75
76
void
Report
(
const
b2ContactVelocityConstraint
* constraints);
77
78
b2StackAllocator
*
m_allocator
;
79
b2ContactListener
*
m_listener
;
80
81
b2Body
**
m_bodies
;
82
b2Contact
**
m_contacts
;
83
b2Joint
**
m_joints
;
84
85
b2Position
*
m_positions
;
86
b2Velocity
*
m_velocities
;
87
88
int32
m_bodyCount
;
89
int32
m_jointCount
;
90
int32
m_contactCount
;
91
92
int32
m_bodyCapacity
;
93
int32
m_contactCapacity
;
94
int32
m_jointCapacity
;
95
};
96
97
#endif
b2_body.h
b2Island
This is an internal class.
Definition:
b2_island.h:38
b2ContactVelocityConstraint
Definition:
b2_contact_solver.h:46
b2Body::m_islandIndex
int32 m_islandIndex
Definition:
b2_body.h:439
b2Velocity
This is an internal structure.
Definition:
b2_time_step.h:60
b2Island::m_positions
b2Position * m_positions
Definition:
b2_island.h:85
b2Island::m_listener
b2ContactListener * m_listener
Definition:
b2_island.h:79
b2Island::Add
void Add(b2Joint *joint)
Definition:
b2_island.h:70
b2Island::m_jointCount
int32 m_jointCount
Definition:
b2_island.h:89
b2Island::Report
void Report(const b2ContactVelocityConstraint *constraints)
Definition:
b2_island.cpp:521
b2TimeStep
This is an internal structure.
Definition:
b2_time_step.h:42
b2Contact
Definition:
b2_contact.h:88
b2Island::m_contactCapacity
int32 m_contactCapacity
Definition:
b2_island.h:93
b2Vec2
A 2D column vector.
Definition:
b2_math.h:41
b2Island::SolveTOI
void SolveTOI(const b2TimeStep &subStep, int32 toiIndexA, int32 toiIndexB)
Definition:
b2_island.cpp:389
int32
signed int int32
Definition:
b2_types.h:28
b2Island::m_velocities
b2Velocity * m_velocities
Definition:
b2_island.h:86
b2Island::m_jointCapacity
int32 m_jointCapacity
Definition:
b2_island.h:94
b2Island::m_bodyCount
int32 m_bodyCount
Definition:
b2_island.h:88
b2Body
A rigid body. These are created via b2World::CreateBody.
Definition:
b2_body.h:128
b2Island::m_bodies
b2Body ** m_bodies
Definition:
b2_island.h:81
b2Island::m_contacts
b2Contact ** m_contacts
Definition:
b2_island.h:82
b2Profile
Profiling data. Times are in milliseconds.
Definition:
b2_time_step.h:29
b2Island::~b2Island
~b2Island()
Definition:
b2_island.cpp:178
b2_math.h
b2Island::m_allocator
b2StackAllocator * m_allocator
Definition:
b2_island.h:78
b2StackAllocator
Definition:
b2_stack_allocator.h:42
b2Island::b2Island
b2Island(int32 bodyCapacity, int32 contactCapacity, int32 jointCapacity, b2StackAllocator *allocator, b2ContactListener *listener)
Definition:
b2_island.cpp:153
step
unsigned int step
b2Island::Add
void Add(b2Contact *contact)
Definition:
b2_island.h:64
b2Island::Clear
void Clear()
Definition:
b2_island.h:45
b2Island::m_joints
b2Joint ** m_joints
Definition:
b2_island.h:83
b2Joint
Definition:
b2_joint.h:110
b2ContactListener
Definition:
b2_world_callbacks.h:86
b2Island::Solve
void Solve(b2Profile *profile, const b2TimeStep &step, const b2Vec2 &gravity, bool allowSleep)
Definition:
b2_island.cpp:188
b2Island::m_bodyCapacity
int32 m_bodyCapacity
Definition:
b2_island.h:92
b2_time_step.h
b2Position
This is an internal structure.
Definition:
b2_time_step.h:53
b2Island::m_contactCount
int32 m_contactCount
Definition:
b2_island.h:90
b2Island::Add
void Add(b2Body *body)
Definition:
b2_island.h:56
b2Assert
#define b2Assert(A)
Definition:
b2_common.h:37
mvsim
Author(s):
autogenerated on Tue Jul 4 2023 03:08:19