b2PulleyJoint.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_PULLEY_JOINT_H
20 #define B2_PULLEY_JOINT_H
21 
23 
25 
29 {
31  {
33  groundAnchorA.Set(-1.0f, 1.0f);
34  groundAnchorB.Set(1.0f, 1.0f);
35  localAnchorA.Set(-1.0f, 0.0f);
36  localAnchorB.Set(1.0f, 0.0f);
37  lengthA = 0.0f;
38  lengthB = 0.0f;
39  ratio = 1.0f;
40  collideConnected = true;
41  }
42 
46  const b2Vec2& anchorA, const b2Vec2& anchorB,
47  float32 ratio);
48 
51 
54 
57 
60 
63 
66 
69 };
70 
79 class b2PulleyJoint : public b2Joint
80 {
81 public:
82  b2Vec2 GetAnchorA() const;
83  b2Vec2 GetAnchorB() const;
84 
85  b2Vec2 GetReactionForce(float32 inv_dt) const;
86  float32 GetReactionTorque(float32 inv_dt) const;
87 
89  b2Vec2 GetGroundAnchorA() const;
90 
92  b2Vec2 GetGroundAnchorB() const;
93 
95  float32 GetLengthA() const;
96 
98  float32 GetLengthB() const;
99 
101  float32 GetRatio() const;
102 
104  float32 GetCurrentLengthA() const;
105 
107  float32 GetCurrentLengthB() const;
108 
110  void Dump();
111 
113  void ShiftOrigin(const b2Vec2& newOrigin);
114 
115 protected:
116 
117  friend class b2Joint;
118  b2PulleyJoint(const b2PulleyJointDef* data);
119 
120  void InitVelocityConstraints(const b2SolverData& data);
121  void SolveVelocityConstraints(const b2SolverData& data);
122  bool SolvePositionConstraints(const b2SolverData& data);
123 
128 
129  // Solver shared
135 
136  // Solver temp
150 };
151 
152 #endif
b2Vec2 m_localAnchorA
virtual void SolveVelocityConstraints(const b2SolverData &data)=0
b2Vec2 m_localCenterB
f
Joint definitions are used to construct joints.
Definition: b2Joint.h:74
float32 lengthA
The a reference length for the segment attached to bodyA.
Definition: b2PulleyJoint.h:62
b2Vec2 localAnchorA
The local anchor point relative to bodyA's origin.
Definition: b2PulleyJoint.h:56
b2Vec2 localAnchorB
The local anchor point relative to bodyB's origin.
Definition: b2PulleyJoint.h:59
Solver Data.
Definition: b2TimeStep.h:63
float32 ratio
The pulley ratio, used to simulate a block-and-tackle.
Definition: b2PulleyJoint.h:68
A 2D column vector.
Definition: b2Math.h:53
float32 m_lengthA
signed int int32
Definition: b2Settings.h:31
b2Vec2 groundAnchorB
The second ground anchor in world coordinates. This point never moves.
Definition: b2PulleyJoint.h:53
A rigid body. These are created via b2World::CreateBody.
Definition: b2Body.h:126
float32 m_invMassB
virtual void InitVelocityConstraints(const b2SolverData &data)=0
const float32 b2_minPulleyLength
Definition: b2PulleyJoint.h:24
bool collideConnected
Set this flag to true if the attached bodies should collide.
Definition: b2Joint.h:98
b2Vec2 m_localCenterA
virtual bool SolvePositionConstraints(const b2SolverData &data)=0
b2Vec2 m_localAnchorB
b2Vec2 groundAnchorA
The first ground anchor in world coordinates. This point never moves.
Definition: b2PulleyJoint.h:50
void Initialize(b2Body *bodyA, b2Body *bodyB, const b2Vec2 &groundAnchorA, const b2Vec2 &groundAnchorB, const b2Vec2 &anchorA, const b2Vec2 &anchorB, float32 ratio)
Initialize the bodies, anchors, lengths, max lengths, and ratio using the world anchors.
b2Vec2 m_groundAnchorA
float32 m_constant
b2JointType type
The joint type is set automatically for concrete joint types.
Definition: b2Joint.h:86
float32 m_impulse
b2Vec2 m_groundAnchorB
b2Body * bodyA
The first attached body.
Definition: b2Joint.h:92
void Set(float32 x_, float32 y_)
Set this vector to some specified coordinates.
Definition: b2Math.h:65
float32 m_lengthB
float32 m_invMassA
b2Body * bodyB
The second attached body.
Definition: b2Joint.h:95
float float32
Definition: b2Settings.h:35
float32 lengthB
The a reference length for the segment attached to bodyB.
Definition: b2PulleyJoint.h:65


mvsim
Author(s):
autogenerated on Thu Jun 6 2019 19:36:40