b2RopeJoint.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_ROPE_JOINT_H
20 #define B2_ROPE_JOINT_H
21 
23 
28 struct b2RopeJointDef : public b2JointDef
29 {
31  {
32  type = e_ropeJoint;
33  localAnchorA.Set(-1.0f, 0.0f);
34  localAnchorB.Set(1.0f, 0.0f);
35  maxLength = 0.0f;
36  }
37 
40 
43 
48 };
49 
58 class b2RopeJoint : public b2Joint
59 {
60 public:
61  b2Vec2 GetAnchorA() const;
62  b2Vec2 GetAnchorB() const;
63 
64  b2Vec2 GetReactionForce(float32 inv_dt) const;
65  float32 GetReactionTorque(float32 inv_dt) const;
66 
68  const b2Vec2& GetLocalAnchorA() const { return m_localAnchorA; }
69 
71  const b2Vec2& GetLocalAnchorB() const { return m_localAnchorB; }
72 
74  void SetMaxLength(float32 length) { m_maxLength = length; }
75  float32 GetMaxLength() const;
76 
77  b2LimitState GetLimitState() const;
78 
80  void Dump();
81 
82 protected:
83 
84  friend class b2Joint;
85  b2RopeJoint(const b2RopeJointDef* data);
86 
87  void InitVelocityConstraints(const b2SolverData& data);
88  void SolveVelocityConstraints(const b2SolverData& data);
89  bool SolvePositionConstraints(const b2SolverData& data);
90 
91  // Solver shared
97 
98  // Solver temp
112 };
113 
114 #endif
virtual void SolveVelocityConstraints(const b2SolverData &data)=0
int32 m_indexA
Definition: b2RopeJoint.h:99
f
Joint definitions are used to construct joints.
Definition: b2Joint.h:74
b2Vec2 localAnchorA
The local anchor point relative to bodyA's origin.
Definition: b2RopeJoint.h:39
b2LimitState
Definition: b2Joint.h:45
b2Vec2 m_u
Definition: b2RopeJoint.h:101
b2Vec2 m_localAnchorA
Definition: b2RopeJoint.h:92
b2Vec2 m_rA
Definition: b2RopeJoint.h:102
Solver Data.
Definition: b2TimeStep.h:63
A 2D column vector.
Definition: b2Math.h:53
const b2Vec2 & GetLocalAnchorB() const
The local anchor point relative to bodyB's origin.
Definition: b2RopeJoint.h:71
signed int int32
Definition: b2Settings.h:31
float32 m_impulse
Definition: b2RopeJoint.h:96
b2Vec2 m_rB
Definition: b2RopeJoint.h:103
float32 m_maxLength
Definition: b2RopeJoint.h:94
float32 m_invIA
Definition: b2RopeJoint.h:108
b2Vec2 m_localCenterB
Definition: b2RopeJoint.h:105
virtual void InitVelocityConstraints(const b2SolverData &data)=0
float32 maxLength
Definition: b2RopeJoint.h:47
virtual bool SolvePositionConstraints(const b2SolverData &data)=0
float32 m_mass
Definition: b2RopeJoint.h:110
b2Vec2 m_localAnchorB
Definition: b2RopeJoint.h:93
float32 m_invMassB
Definition: b2RopeJoint.h:107
b2Vec2 localAnchorB
The local anchor point relative to bodyB's origin.
Definition: b2RopeJoint.h:42
int32 m_indexB
Definition: b2RopeJoint.h:100
float32 m_invIB
Definition: b2RopeJoint.h:109
b2JointType type
The joint type is set automatically for concrete joint types.
Definition: b2Joint.h:86
void SetMaxLength(float32 length)
Set/Get the maximum length of the rope.
Definition: b2RopeJoint.h:74
b2LimitState m_state
Definition: b2RopeJoint.h:111
float32 m_length
Definition: b2RopeJoint.h:95
const b2Vec2 & GetLocalAnchorA() const
The local anchor point relative to bodyA's origin.
Definition: b2RopeJoint.h:68
float32 m_invMassA
Definition: b2RopeJoint.h:106
void Set(float32 x_, float32 y_)
Set this vector to some specified coordinates.
Definition: b2Math.h:65
b2Vec2 m_localCenterA
Definition: b2RopeJoint.h:104
float float32
Definition: b2Settings.h:35


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