Main Page
Namespaces
Classes
Files
File List
File Members
externals
Box2D
Box2D
Dynamics
Joints
b2WeldJoint.h
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2006-2011 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_WELD_JOINT_H
20
#define B2_WELD_JOINT_H
21
22
#include <
Box2D/Dynamics/Joints/b2Joint.h
>
23
27
struct
b2WeldJointDef
:
public
b2JointDef
28
{
29
b2WeldJointDef
()
30
{
31
type
=
e_weldJoint
;
32
localAnchorA
.
Set
(0.0
f
, 0.0
f
);
33
localAnchorB
.
Set
(0.0
f
, 0.0
f
);
34
referenceAngle
= 0.0f;
35
frequencyHz
= 0.0f;
36
dampingRatio
= 0.0f;
37
}
38
41
void
Initialize
(
b2Body
*
bodyA
,
b2Body
*
bodyB
,
const
b2Vec2
& anchor);
42
44
b2Vec2
localAnchorA
;
45
47
b2Vec2
localAnchorB
;
48
50
float32
referenceAngle
;
51
54
float32
frequencyHz
;
55
57
float32
dampingRatio
;
58
};
59
62
class
b2WeldJoint
:
public
b2Joint
63
{
64
public
:
65
b2Vec2
GetAnchorA()
const
;
66
b2Vec2
GetAnchorB()
const
;
67
68
b2Vec2
GetReactionForce(
float32
inv_dt)
const
;
69
float32
GetReactionTorque(
float32
inv_dt)
const
;
70
72
const
b2Vec2
&
GetLocalAnchorA
()
const
{
return
m_localAnchorA; }
73
75
const
b2Vec2
&
GetLocalAnchorB
()
const
{
return
m_localAnchorB; }
76
78
float32
GetReferenceAngle
()
const
{
return
m_referenceAngle; }
79
81
void
SetFrequency
(
float32
hz) { m_frequencyHz = hz; }
82
float32
GetFrequency
()
const
{
return
m_frequencyHz; }
83
85
void
SetDampingRatio
(
float32
ratio) { m_dampingRatio = ratio; }
86
float32
GetDampingRatio
()
const
{
return
m_dampingRatio; }
87
89
void
Dump();
90
91
protected
:
92
93
friend
class
b2Joint
;
94
95
b2WeldJoint
(
const
b2WeldJointDef
* def);
96
97
void
InitVelocityConstraints
(
const
b2SolverData
& data);
98
void
SolveVelocityConstraints
(
const
b2SolverData
& data);
99
bool
SolvePositionConstraints
(
const
b2SolverData
& data);
100
101
float32
m_frequencyHz
;
102
float32
m_dampingRatio
;
103
float32
m_bias
;
104
105
// Solver shared
106
b2Vec2
m_localAnchorA
;
107
b2Vec2
m_localAnchorB
;
108
float32
m_referenceAngle
;
109
float32
m_gamma
;
110
b2Vec3
m_impulse
;
111
112
// Solver temp
113
int32
m_indexA
;
114
int32
m_indexB
;
115
b2Vec2
m_rA
;
116
b2Vec2
m_rB
;
117
b2Vec2
m_localCenterA
;
118
b2Vec2
m_localCenterB
;
119
float32
m_invMassA
;
120
float32
m_invMassB
;
121
float32
m_invIA
;
122
float32
m_invIB
;
123
b2Mat33
m_mass
;
124
};
125
126
#endif
b2WeldJoint::m_localAnchorA
b2Vec2 m_localAnchorA
Definition:
b2WeldJoint.h:106
b2Joint::SolveVelocityConstraints
virtual void SolveVelocityConstraints(const b2SolverData &data)=0
b2WeldJointDef::referenceAngle
float32 referenceAngle
The bodyB angle minus bodyA angle in the reference state (radians).
Definition:
b2WeldJoint.h:50
b2WeldJoint::m_invMassA
float32 m_invMassA
Definition:
b2WeldJoint.h:119
b2WeldJoint::m_rB
b2Vec2 m_rB
Definition:
b2WeldJoint.h:116
b2WeldJoint::m_dampingRatio
float32 m_dampingRatio
Definition:
b2WeldJoint.h:102
b2WeldJointDef::localAnchorB
b2Vec2 localAnchorB
The local anchor point relative to bodyB's origin.
Definition:
b2WeldJoint.h:47
b2WeldJoint::GetReferenceAngle
float32 GetReferenceAngle() const
Get the reference angle.
Definition:
b2WeldJoint.h:78
b2WeldJointDef
Definition:
b2WeldJoint.h:27
f
f
b2JointDef
Joint definitions are used to construct joints.
Definition:
b2Joint.h:74
b2WeldJoint::GetDampingRatio
float32 GetDampingRatio() const
Definition:
b2WeldJoint.h:86
b2WeldJointDef::dampingRatio
float32 dampingRatio
The damping ratio. 0 = no damping, 1 = critical damping.
Definition:
b2WeldJoint.h:57
b2WeldJoint::m_referenceAngle
float32 m_referenceAngle
Definition:
b2WeldJoint.h:108
b2SolverData
Solver Data.
Definition:
b2TimeStep.h:63
b2WeldJoint::m_localCenterA
b2Vec2 m_localCenterA
Definition:
b2WeldJoint.h:117
b2Vec2
A 2D column vector.
Definition:
b2Math.h:53
b2WeldJoint::SetDampingRatio
void SetDampingRatio(float32 ratio)
Set/get damping ratio.
Definition:
b2WeldJoint.h:85
int32
signed int int32
Definition:
b2Settings.h:31
b2WeldJoint::m_bias
float32 m_bias
Definition:
b2WeldJoint.h:103
b2WeldJoint::GetLocalAnchorB
const b2Vec2 & GetLocalAnchorB() const
The local anchor point relative to bodyB's origin.
Definition:
b2WeldJoint.h:75
b2WeldJoint::GetFrequency
float32 GetFrequency() const
Definition:
b2WeldJoint.h:82
b2Vec3
A 2D column vector with 3 elements.
Definition:
b2Math.h:144
b2Body
A rigid body. These are created via b2World::CreateBody.
Definition:
b2Body.h:126
b2WeldJoint::m_invMassB
float32 m_invMassB
Definition:
b2WeldJoint.h:120
b2WeldJoint::SetFrequency
void SetFrequency(float32 hz)
Set/get frequency in Hz.
Definition:
b2WeldJoint.h:81
b2WeldJoint::m_localCenterB
b2Vec2 m_localCenterB
Definition:
b2WeldJoint.h:118
b2Joint::InitVelocityConstraints
virtual void InitVelocityConstraints(const b2SolverData &data)=0
b2WeldJoint::m_indexB
int32 m_indexB
Definition:
b2WeldJoint.h:114
b2WeldJoint::m_indexA
int32 m_indexA
Definition:
b2WeldJoint.h:113
b2Joint.h
b2WeldJointDef::localAnchorA
b2Vec2 localAnchorA
The local anchor point relative to bodyA's origin.
Definition:
b2WeldJoint.h:44
b2Joint::SolvePositionConstraints
virtual bool SolvePositionConstraints(const b2SolverData &data)=0
b2WeldJoint
Definition:
b2WeldJoint.h:62
b2WeldJoint::m_impulse
b2Vec3 m_impulse
Definition:
b2WeldJoint.h:110
b2WeldJoint::m_invIA
float32 m_invIA
Definition:
b2WeldJoint.h:121
b2WeldJoint::m_invIB
float32 m_invIB
Definition:
b2WeldJoint.h:122
b2WeldJoint::m_frequencyHz
float32 m_frequencyHz
Definition:
b2WeldJoint.h:101
b2Mat33
A 3-by-3 matrix. Stored in column-major order.
Definition:
b2Math.h:257
b2WeldJoint::m_mass
b2Mat33 m_mass
Definition:
b2WeldJoint.h:123
b2Joint
Definition:
b2Joint.h:103
b2JointDef::type
b2JointType type
The joint type is set automatically for concrete joint types.
Definition:
b2Joint.h:86
b2WeldJoint::m_gamma
float32 m_gamma
Definition:
b2WeldJoint.h:109
b2WeldJoint::m_localAnchorB
b2Vec2 m_localAnchorB
Definition:
b2WeldJoint.h:107
b2WeldJointDef::frequencyHz
float32 frequencyHz
Definition:
b2WeldJoint.h:54
e_weldJoint
Definition:
b2Joint.h:39
b2JointDef::bodyA
b2Body * bodyA
The first attached body.
Definition:
b2Joint.h:92
b2WeldJointDef::Initialize
void Initialize(b2Body *bodyA, b2Body *bodyB, const b2Vec2 &anchor)
Definition:
b2WeldJoint.cpp:37
b2WeldJointDef::b2WeldJointDef
b2WeldJointDef()
Definition:
b2WeldJoint.h:29
b2Vec2::Set
void Set(float32 x_, float32 y_)
Set this vector to some specified coordinates.
Definition:
b2Math.h:65
b2WeldJoint::GetLocalAnchorA
const b2Vec2 & GetLocalAnchorA() const
The local anchor point relative to bodyA's origin.
Definition:
b2WeldJoint.h:72
b2JointDef::bodyB
b2Body * bodyB
The second attached body.
Definition:
b2Joint.h:95
float32
float float32
Definition:
b2Settings.h:35
b2WeldJoint::m_rA
b2Vec2 m_rA
Definition:
b2WeldJoint.h:115
mvsim
Author(s):
autogenerated on Thu Jun 6 2019 19:36:40