b2MouseJoint.h
Go to the documentation of this file.
1 /*
2 * Copyright (c) 2006-2007 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_MOUSE_JOINT_H
20 #define B2_MOUSE_JOINT_H
21 
23 
26 struct b2MouseJointDef : public b2JointDef
27 {
29  {
31  target.Set(0.0f, 0.0f);
32  maxForce = 0.0f;
33  frequencyHz = 5.0f;
34  dampingRatio = 0.7f;
35  }
36 
40 
45 
48 
51 };
52 
60 class b2MouseJoint : public b2Joint
61 {
62 public:
63 
65  b2Vec2 GetAnchorA() const;
66 
68  b2Vec2 GetAnchorB() const;
69 
71  b2Vec2 GetReactionForce(float32 inv_dt) const;
72 
74  float32 GetReactionTorque(float32 inv_dt) const;
75 
77  void SetTarget(const b2Vec2& target);
78  const b2Vec2& GetTarget() const;
79 
81  void SetMaxForce(float32 force);
82  float32 GetMaxForce() const;
83 
85  void SetFrequency(float32 hz);
86  float32 GetFrequency() const;
87 
89  void SetDampingRatio(float32 ratio);
90  float32 GetDampingRatio() const;
91 
93  void Dump() { b2Log("Mouse joint dumping is not supported.\n"); }
94 
96  void ShiftOrigin(const b2Vec2& newOrigin);
97 
98 protected:
99  friend class b2Joint;
100 
101  b2MouseJoint(const b2MouseJointDef* def);
102 
106 
112 
113  // Solver shared
117 
118  // Solver temp
127 };
128 
129 #endif
b2Vec2 m_targetA
Definition: b2MouseJoint.h:108
virtual void SolveVelocityConstraints(const b2SolverData &data)=0
float32 m_invIB
Definition: b2MouseJoint.h:124
void b2Log(const char *string,...)
Logging function.
Definition: b2Settings.cpp:38
float32 m_dampingRatio
Definition: b2MouseJoint.h:110
float32 dampingRatio
The damping ratio. 0 = no damping, 1 = critical damping.
Definition: b2MouseJoint.h:50
b2Vec2 m_localAnchorB
Definition: b2MouseJoint.h:107
Joint definitions are used to construct joints.
Definition: b2Joint.h:74
Solver Data.
Definition: b2TimeStep.h:63
A 2D column vector.
Definition: b2Math.h:52
signed int int32
Definition: b2Settings.h:31
b2Vec2 m_localCenterB
Definition: b2MouseJoint.h:122
b2Vec2 m_impulse
Definition: b2MouseJoint.h:114
float32 frequencyHz
The response speed.
Definition: b2MouseJoint.h:47
virtual void InitVelocityConstraints(const b2SolverData &data)=0
float32 m_maxForce
Definition: b2MouseJoint.h:115
virtual bool SolvePositionConstraints(const b2SolverData &data)=0
GLint GLenum GLsizei GLint GLsizei const GLvoid * data
float32 m_invMassB
Definition: b2MouseJoint.h:123
GLenum target
float32 m_frequencyHz
Definition: b2MouseJoint.h:109
void Dump()
The mouse joint does not support dumping.
Definition: b2MouseJoint.h:93
float32 maxForce
Definition: b2MouseJoint.h:44
b2Mat22 m_mass
Definition: b2MouseJoint.h:125
float32 m_gamma
Definition: b2MouseJoint.h:116
A 2-by-2 matrix. Stored in column-major order.
Definition: b2Math.h:182
float32 m_beta
Definition: b2MouseJoint.h:111
GLuint GLuint GLsizei GLenum type
float float32
Definition: b2Settings.h:35
GLdouble GLdouble GLdouble GLdouble GLdouble GLdouble f


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