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 
23 
27 struct b2WeldJointDef : public b2JointDef
28 {
30  {
31  type = e_weldJoint;
32  localAnchorA.Set(0.0f, 0.0f);
33  localAnchorB.Set(0.0f, 0.0f);
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 
45 
48 
51 
55 
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 
100 
104 
105  // Solver shared
111 
112  // Solver temp
124 };
125 
126 #endif
b2Vec2 m_localAnchorA
Definition: b2WeldJoint.h:106
virtual void SolveVelocityConstraints(const b2SolverData &data)=0
float32 referenceAngle
The bodyB angle minus bodyA angle in the reference state (radians).
Definition: b2WeldJoint.h:50
float32 m_invMassA
Definition: b2WeldJoint.h:119
b2Vec2 m_rB
Definition: b2WeldJoint.h:116
float32 m_dampingRatio
Definition: b2WeldJoint.h:102
b2Vec2 localAnchorB
The local anchor point relative to bodyB's origin.
Definition: b2WeldJoint.h:47
float32 GetReferenceAngle() const
Get the reference angle.
Definition: b2WeldJoint.h:78
Joint definitions are used to construct joints.
Definition: b2Joint.h:74
float32 GetDampingRatio() const
Definition: b2WeldJoint.h:86
float32 dampingRatio
The damping ratio. 0 = no damping, 1 = critical damping.
Definition: b2WeldJoint.h:57
float32 m_referenceAngle
Definition: b2WeldJoint.h:108
Solver Data.
Definition: b2TimeStep.h:63
b2Vec2 m_localCenterA
Definition: b2WeldJoint.h:117
A 2D column vector.
Definition: b2Math.h:52
void SetDampingRatio(float32 ratio)
Set/get damping ratio.
Definition: b2WeldJoint.h:85
signed int int32
Definition: b2Settings.h:31
float32 m_bias
Definition: b2WeldJoint.h:103
const b2Vec2 & GetLocalAnchorB() const
The local anchor point relative to bodyB's origin.
Definition: b2WeldJoint.h:75
float32 GetFrequency() const
Definition: b2WeldJoint.h:82
A 2D column vector with 3 elements.
Definition: b2Math.h:143
A rigid body. These are created via b2World::CreateBody.
Definition: b2Body.h:126
float32 m_invMassB
Definition: b2WeldJoint.h:120
void SetFrequency(float32 hz)
Set/get frequency in Hz.
Definition: b2WeldJoint.h:81
b2Vec2 m_localCenterB
Definition: b2WeldJoint.h:118
virtual void InitVelocityConstraints(const b2SolverData &data)=0
int32 m_indexB
Definition: b2WeldJoint.h:114
int32 m_indexA
Definition: b2WeldJoint.h:113
b2Vec2 localAnchorA
The local anchor point relative to bodyA's origin.
Definition: b2WeldJoint.h:44
virtual bool SolvePositionConstraints(const b2SolverData &data)=0
GLint GLenum GLsizei GLint GLsizei const GLvoid * data
b2Vec3 m_impulse
Definition: b2WeldJoint.h:110
float32 m_invIA
Definition: b2WeldJoint.h:121
float32 m_invIB
Definition: b2WeldJoint.h:122
float32 m_frequencyHz
Definition: b2WeldJoint.h:101
A 3-by-3 matrix. Stored in column-major order.
Definition: b2Math.h:256
b2Mat33 m_mass
Definition: b2WeldJoint.h:123
float32 m_gamma
Definition: b2WeldJoint.h:109
b2Vec2 m_localAnchorB
Definition: b2WeldJoint.h:107
float32 frequencyHz
Definition: b2WeldJoint.h:54
GLuint GLuint GLsizei GLenum type
b2Body * bodyA
The first attached body.
Definition: b2Joint.h:92
void Initialize(b2Body *bodyA, b2Body *bodyB, const b2Vec2 &anchor)
Definition: b2WeldJoint.cpp:37
void Set(float32 x_, float32 y_)
Set this vector to some specified coordinates.
Definition: b2Math.h:64
const b2Vec2 & GetLocalAnchorA() const
The local anchor point relative to bodyA's origin.
Definition: b2WeldJoint.h:72
b2Body * bodyB
The second attached body.
Definition: b2Joint.h:95
float float32
Definition: b2Settings.h:35
b2Vec2 m_rA
Definition: b2WeldJoint.h:115
GLdouble GLdouble GLdouble GLdouble GLdouble GLdouble f


mvsim
Author(s):
autogenerated on Fri May 7 2021 03:05:51