Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
externals
Box2D
Box2D
Dynamics
Joints
b2FrictionJoint.h
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2006-2007 Erin Catto http://www.box2d.org
3
*
4
* This software is provided 'as-is', without any express or implied
5
* warranty. In no event will the authors be held liable for any damages
6
* arising from the use of this software.
7
* Permission is granted to anyone to use this software for any purpose,
8
* including commercial applications, and to alter it and redistribute it
9
* freely, subject to the following restrictions:
10
* 1. The origin of this software must not be misrepresented; you must not
11
* claim that you wrote the original software. If you use this software
12
* in a product, an acknowledgment in the product documentation would be
13
* appreciated but is not required.
14
* 2. Altered source versions must be plainly marked as such, and must not be
15
* misrepresented as being the original software.
16
* 3. This notice may not be removed or altered from any source distribution.
17
*/
18
19
#ifndef B2_FRICTION_JOINT_H
20
#define B2_FRICTION_JOINT_H
21
22
#include <
Box2D/Dynamics/Joints/b2Joint.h
>
23
25
struct
b2FrictionJointDef
:
public
b2JointDef
26
{
27
b2FrictionJointDef
()
28
{
29
type
=
e_frictionJoint
;
30
localAnchorA
.
SetZero
();
31
localAnchorB
.
SetZero
();
32
maxForce
= 0.0f;
33
maxTorque
= 0.0f;
34
}
35
38
void
Initialize
(
b2Body
*
bodyA
,
b2Body
*
bodyB
,
const
b2Vec2
& anchor);
39
41
b2Vec2
localAnchorA
;
42
44
b2Vec2
localAnchorB
;
45
47
float32
maxForce
;
48
50
float32
maxTorque
;
51
};
52
55
class
b2FrictionJoint
:
public
b2Joint
56
{
57
public
:
58
b2Vec2
GetAnchorA()
const
;
59
b2Vec2
GetAnchorB()
const
;
60
61
b2Vec2
GetReactionForce(
float32
inv_dt)
const
;
62
float32
GetReactionTorque(
float32
inv_dt)
const
;
63
65
const
b2Vec2
&
GetLocalAnchorA
()
const
{
return
m_localAnchorA; }
66
68
const
b2Vec2
&
GetLocalAnchorB
()
const
{
return
m_localAnchorB; }
69
71
void
SetMaxForce(
float32
force);
72
74
float32
GetMaxForce()
const
;
75
77
void
SetMaxTorque(
float32
torque);
78
80
float32
GetMaxTorque()
const
;
81
83
void
Dump();
84
85
protected
:
86
87
friend
class
b2Joint
;
88
89
b2FrictionJoint
(
const
b2FrictionJointDef
* def);
90
91
void
InitVelocityConstraints
(
const
b2SolverData
&
data
);
92
void
SolveVelocityConstraints
(
const
b2SolverData
&
data
);
93
bool
SolvePositionConstraints
(
const
b2SolverData
&
data
);
94
95
b2Vec2
m_localAnchorA
;
96
b2Vec2
m_localAnchorB
;
97
98
// Solver shared
99
b2Vec2
m_linearImpulse
;
100
float32
m_angularImpulse
;
101
float32
m_maxForce
;
102
float32
m_maxTorque
;
103
104
// Solver temp
105
int32
m_indexA
;
106
int32
m_indexB
;
107
b2Vec2
m_rA
;
108
b2Vec2
m_rB
;
109
b2Vec2
m_localCenterA
;
110
b2Vec2
m_localCenterB
;
111
float32
m_invMassA
;
112
float32
m_invMassB
;
113
float32
m_invIA
;
114
float32
m_invIB
;
115
b2Mat22
m_linearMass
;
116
float32
m_angularMass
;
117
};
118
119
#endif
b2Joint::SolveVelocityConstraints
virtual void SolveVelocityConstraints(const b2SolverData &data)=0
b2FrictionJointDef::localAnchorA
b2Vec2 localAnchorA
The local anchor point relative to bodyA's origin.
Definition:
b2FrictionJoint.h:41
e_frictionJoint
Definition:
b2Joint.h:40
b2FrictionJointDef::b2FrictionJointDef
b2FrictionJointDef()
Definition:
b2FrictionJoint.h:27
b2JointDef
Joint definitions are used to construct joints.
Definition:
b2Joint.h:74
b2FrictionJoint::m_rB
b2Vec2 m_rB
Definition:
b2FrictionJoint.h:108
b2FrictionJointDef::localAnchorB
b2Vec2 localAnchorB
The local anchor point relative to bodyB's origin.
Definition:
b2FrictionJoint.h:44
b2FrictionJoint
Definition:
b2FrictionJoint.h:55
b2FrictionJointDef::maxForce
float32 maxForce
The maximum friction force in N.
Definition:
b2FrictionJoint.h:47
b2FrictionJoint::m_localAnchorB
b2Vec2 m_localAnchorB
Definition:
b2FrictionJoint.h:96
b2FrictionJoint::m_indexA
int32 m_indexA
Definition:
b2FrictionJoint.h:105
b2FrictionJoint::m_angularMass
float32 m_angularMass
Definition:
b2FrictionJoint.h:116
b2SolverData
Solver Data.
Definition:
b2TimeStep.h:63
b2Vec2::SetZero
void SetZero()
Set this vector to all zeros.
Definition:
b2Math.h:61
b2Vec2
A 2D column vector.
Definition:
b2Math.h:52
b2FrictionJoint::GetLocalAnchorA
const b2Vec2 & GetLocalAnchorA() const
The local anchor point relative to bodyA's origin.
Definition:
b2FrictionJoint.h:65
b2FrictionJoint::m_localCenterB
b2Vec2 m_localCenterB
Definition:
b2FrictionJoint.h:110
b2FrictionJointDef
Friction joint definition.
Definition:
b2FrictionJoint.h:25
int32
signed int int32
Definition:
b2Settings.h:31
b2FrictionJoint::m_maxForce
float32 m_maxForce
Definition:
b2FrictionJoint.h:101
b2FrictionJoint::m_invIB
float32 m_invIB
Definition:
b2FrictionJoint.h:114
b2Body
A rigid body. These are created via b2World::CreateBody.
Definition:
b2Body.h:126
b2FrictionJoint::m_invMassB
float32 m_invMassB
Definition:
b2FrictionJoint.h:112
b2FrictionJoint::GetLocalAnchorB
const b2Vec2 & GetLocalAnchorB() const
The local anchor point relative to bodyB's origin.
Definition:
b2FrictionJoint.h:68
b2Joint::InitVelocityConstraints
virtual void InitVelocityConstraints(const b2SolverData &data)=0
b2FrictionJoint::m_rA
b2Vec2 m_rA
Definition:
b2FrictionJoint.h:107
b2Joint.h
b2Joint::SolvePositionConstraints
virtual bool SolvePositionConstraints(const b2SolverData &data)=0
b2FrictionJoint::m_invIA
float32 m_invIA
Definition:
b2FrictionJoint.h:113
b2FrictionJoint::m_indexB
int32 m_indexB
Definition:
b2FrictionJoint.h:106
b2FrictionJoint::m_maxTorque
float32 m_maxTorque
Definition:
b2FrictionJoint.h:102
data
GLint GLenum GLsizei GLint GLsizei const GLvoid * data
b2FrictionJointDef::maxTorque
float32 maxTorque
The maximum friction torque in N-m.
Definition:
b2FrictionJoint.h:50
b2FrictionJoint::m_angularImpulse
float32 m_angularImpulse
Definition:
b2FrictionJoint.h:100
b2FrictionJoint::m_invMassA
float32 m_invMassA
Definition:
b2FrictionJoint.h:111
b2FrictionJoint::m_linearMass
b2Mat22 m_linearMass
Definition:
b2FrictionJoint.h:115
b2Joint
Definition:
b2Joint.h:103
b2FrictionJoint::m_localAnchorA
b2Vec2 m_localAnchorA
Definition:
b2FrictionJoint.h:95
b2FrictionJointDef::Initialize
void Initialize(b2Body *bodyA, b2Body *bodyB, const b2Vec2 &anchor)
Definition:
b2FrictionJoint.cpp:35
b2Mat22
A 2-by-2 matrix. Stored in column-major order.
Definition:
b2Math.h:182
b2FrictionJoint::m_localCenterA
b2Vec2 m_localCenterA
Definition:
b2FrictionJoint.h:109
type
GLuint GLuint GLsizei GLenum type
b2JointDef::bodyA
b2Body * bodyA
The first attached body.
Definition:
b2Joint.h:92
b2JointDef::bodyB
b2Body * bodyB
The second attached body.
Definition:
b2Joint.h:95
float32
float float32
Definition:
b2Settings.h:35
b2FrictionJoint::m_linearImpulse
b2Vec2 m_linearImpulse
Definition:
b2FrictionJoint.h:99
mvsim
Author(s):
autogenerated on Fri May 7 2021 03:05:51