b2_contact_solver.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_CONTACT_SOLVER_H
24 #define B2_CONTACT_SOLVER_H
25 
26 #include "box2d/b2_collision.h"
27 #include "box2d/b2_math.h"
28 #include "box2d/b2_time_step.h"
29 
30 class b2Contact;
31 class b2Body;
32 class b2StackAllocator;
34 
36 {
41  float normalMass;
42  float tangentMass;
43  float velocityBias;
44 };
45 
47 {
54  float invMassA, invMassB;
55  float invIA, invIB;
56  float friction;
57  float restitution;
58  float threshold;
59  float tangentSpeed;
62 };
63 
65 {
72 };
73 
75 {
76 public:
78  ~b2ContactSolver();
79 
80  void InitializeVelocityConstraints();
81 
82  void WarmStart();
83  void SolveVelocityConstraints();
84  void StoreImpulses();
85 
86  bool SolvePositionConstraints();
87  bool SolveTOIPositionConstraints(int32 toiIndexA, int32 toiIndexB);
88 
96  int m_count;
97 };
98 
99 #endif
100 
This is an internal structure.
Definition: b2_time_step.h:60
b2ContactPositionConstraint * m_positionConstraints
b2Velocity * m_velocities
#define b2_maxManifoldPoints
Definition: b2_common.h:51
This is an internal structure.
Definition: b2_time_step.h:42
b2Contact ** m_contacts
A 2D column vector.
Definition: b2_math.h:41
b2Position * m_positions
signed int int32
Definition: b2_types.h:28
A rigid body. These are created via b2World::CreateBody.
Definition: b2_body.h:128
b2Position * positions
b2ContactVelocityConstraint * m_velocityConstraints
A 2-by-2 matrix. Stored in column-major order.
Definition: b2_math.h:171
This is an internal structure.
Definition: b2_time_step.h:53
b2StackAllocator * allocator
b2StackAllocator * m_allocator
b2Velocity * velocities


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