Main Page
Namespaces
Classes
Files
File List
File Members
externals
Box2D
Box2D
Dynamics
Joints
b2GearJoint.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_GEAR_JOINT_H
20
#define B2_GEAR_JOINT_H
21
22
#include <
Box2D/Dynamics/Joints/b2Joint.h
>
23
26
struct
b2GearJointDef
:
public
b2JointDef
27
{
28
b2GearJointDef
()
29
{
30
type
=
e_gearJoint
;
31
joint1
= NULL;
32
joint2
= NULL;
33
ratio
= 1.0f;
34
}
35
37
b2Joint
*
joint1
;
38
40
b2Joint
*
joint2
;
41
44
float32
ratio
;
45
};
46
56
class
b2GearJoint
:
public
b2Joint
57
{
58
public
:
59
b2Vec2
GetAnchorA()
const
;
60
b2Vec2
GetAnchorB()
const
;
61
62
b2Vec2
GetReactionForce(
float32
inv_dt)
const
;
63
float32
GetReactionTorque(
float32
inv_dt)
const
;
64
66
b2Joint
*
GetJoint1
() {
return
m_joint1; }
67
69
b2Joint
*
GetJoint2
() {
return
m_joint2; }
70
72
void
SetRatio(
float32
ratio
);
73
float32
GetRatio()
const
;
74
76
void
Dump();
77
78
protected
:
79
80
friend
class
b2Joint
;
81
b2GearJoint
(
const
b2GearJointDef
* data);
82
83
void
InitVelocityConstraints
(
const
b2SolverData
& data);
84
void
SolveVelocityConstraints
(
const
b2SolverData
& data);
85
bool
SolvePositionConstraints
(
const
b2SolverData
& data);
86
87
b2Joint
*
m_joint1
;
88
b2Joint
*
m_joint2
;
89
90
b2JointType
m_typeA
;
91
b2JointType
m_typeB
;
92
93
// Body A is connected to body C
94
// Body B is connected to body D
95
b2Body
*
m_bodyC
;
96
b2Body
*
m_bodyD
;
97
98
// Solver shared
99
b2Vec2
m_localAnchorA
;
100
b2Vec2
m_localAnchorB
;
101
b2Vec2
m_localAnchorC
;
102
b2Vec2
m_localAnchorD
;
103
104
b2Vec2
m_localAxisC
;
105
b2Vec2
m_localAxisD
;
106
107
float32
m_referenceAngleA
;
108
float32
m_referenceAngleB
;
109
110
float32
m_constant
;
111
float32
m_ratio
;
112
113
float32
m_impulse
;
114
115
// Solver temp
116
int32
m_indexA, m_indexB, m_indexC,
m_indexD
;
117
b2Vec2
m_lcA, m_lcB, m_lcC,
m_lcD
;
118
float32
m_mA, m_mB, m_mC,
m_mD
;
119
float32
m_iA, m_iB, m_iC,
m_iD
;
120
b2Vec2
m_JvAC,
m_JvBD
;
121
float32
m_JwA, m_JwB, m_JwC,
m_JwD
;
122
float32
m_mass
;
123
};
124
125
#endif
b2GearJoint::m_localAxisD
b2Vec2 m_localAxisD
Definition:
b2GearJoint.h:105
b2GearJoint::m_referenceAngleA
float32 m_referenceAngleA
Definition:
b2GearJoint.h:107
b2GearJoint::m_JvBD
b2Vec2 m_JvBD
Definition:
b2GearJoint.h:120
e_gearJoint
Definition:
b2Joint.h:37
b2Joint::SolveVelocityConstraints
virtual void SolveVelocityConstraints(const b2SolverData &data)=0
b2GearJointDef::joint2
b2Joint * joint2
The second revolute/prismatic joint attached to the gear joint.
Definition:
b2GearJoint.h:40
b2GearJoint::m_joint2
b2Joint * m_joint2
Definition:
b2GearJoint.h:88
b2GearJoint::m_mass
float32 m_mass
Definition:
b2GearJoint.h:122
b2JointDef
Joint definitions are used to construct joints.
Definition:
b2Joint.h:74
b2GearJointDef::ratio
float32 ratio
Definition:
b2GearJoint.h:44
b2GearJoint::m_bodyD
b2Body * m_bodyD
Definition:
b2GearJoint.h:96
b2GearJoint::m_indexD
int32 m_indexD
Definition:
b2GearJoint.h:116
b2GearJoint::GetJoint2
b2Joint * GetJoint2()
Get the second joint.
Definition:
b2GearJoint.h:69
b2GearJointDef
Definition:
b2GearJoint.h:26
b2GearJoint::m_constant
float32 m_constant
Definition:
b2GearJoint.h:110
b2GearJoint::m_ratio
float32 m_ratio
Definition:
b2GearJoint.h:111
b2GearJoint
Definition:
b2GearJoint.h:56
b2GearJoint::m_typeA
b2JointType m_typeA
Definition:
b2GearJoint.h:90
b2SolverData
Solver Data.
Definition:
b2TimeStep.h:63
b2Vec2
A 2D column vector.
Definition:
b2Math.h:53
b2GearJoint::m_iD
float32 m_iD
Definition:
b2GearJoint.h:119
int32
signed int int32
Definition:
b2Settings.h:31
b2Body
A rigid body. These are created via b2World::CreateBody.
Definition:
b2Body.h:126
b2GearJoint::m_mD
float32 m_mD
Definition:
b2GearJoint.h:118
b2GearJoint::m_localAnchorB
b2Vec2 m_localAnchorB
Definition:
b2GearJoint.h:100
b2GearJoint::m_bodyC
b2Body * m_bodyC
Definition:
b2GearJoint.h:95
b2GearJoint::m_joint1
b2Joint * m_joint1
Definition:
b2GearJoint.h:87
b2GearJoint::m_localAnchorC
b2Vec2 m_localAnchorC
Definition:
b2GearJoint.h:101
b2Joint::InitVelocityConstraints
virtual void InitVelocityConstraints(const b2SolverData &data)=0
b2Joint.h
b2Joint::SolvePositionConstraints
virtual bool SolvePositionConstraints(const b2SolverData &data)=0
b2JointType
b2JointType
Definition:
b2Joint.h:29
b2GearJointDef::joint1
b2Joint * joint1
The first revolute/prismatic joint attached to the gear joint.
Definition:
b2GearJoint.h:37
b2GearJoint::m_referenceAngleB
float32 m_referenceAngleB
Definition:
b2GearJoint.h:108
b2GearJoint::GetJoint1
b2Joint * GetJoint1()
Get the first joint.
Definition:
b2GearJoint.h:66
b2GearJoint::m_localAnchorA
b2Vec2 m_localAnchorA
Definition:
b2GearJoint.h:99
b2Joint
Definition:
b2Joint.h:103
b2JointDef::type
b2JointType type
The joint type is set automatically for concrete joint types.
Definition:
b2Joint.h:86
b2GearJointDef::b2GearJointDef
b2GearJointDef()
Definition:
b2GearJoint.h:28
b2GearJoint::m_impulse
float32 m_impulse
Definition:
b2GearJoint.h:113
b2GearJoint::m_localAxisC
b2Vec2 m_localAxisC
Definition:
b2GearJoint.h:104
b2GearJoint::m_typeB
b2JointType m_typeB
Definition:
b2GearJoint.h:91
b2Joint::b2GearJoint
friend class b2GearJoint
Definition:
b2Joint.h:156
b2GearJoint::m_localAnchorD
b2Vec2 m_localAnchorD
Definition:
b2GearJoint.h:102
b2GearJoint::m_JwD
float32 m_JwD
Definition:
b2GearJoint.h:121
b2GearJoint::m_lcD
b2Vec2 m_lcD
Definition:
b2GearJoint.h:117
float32
float float32
Definition:
b2Settings.h:35
mvsim
Author(s):
autogenerated on Thu Jun 6 2019 19:36:40