b2Rope.h
Go to the documentation of this file.
1 /*
2 * Copyright (c) 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_H
20 #define B2_ROPE_H
21 
22 #include <Box2D/Common/b2Math.h>
23 
24 class b2Draw;
25 
27 struct b2RopeDef
28 {
30  {
31  vertices = NULL;
32  count = 0;
33  masses = NULL;
34  gravity.SetZero();
35  damping = 0.1f;
36  k2 = 0.9f;
37  k3 = 0.1f;
38  }
39 
42 
45 
48 
51 
54 
57 
60 };
61 
63 class b2Rope
64 {
65 public:
66  b2Rope();
67  ~b2Rope();
68 
70  void Initialize(const b2RopeDef* def);
71 
73  void Step(float32 timeStep, int32 iterations);
74 
77  {
78  return m_count;
79  }
80 
82  const b2Vec2* GetVertices() const
83  {
84  return m_ps;
85  }
86 
88  void Draw(b2Draw* draw) const;
89 
91  void SetAngle(float32 angle);
92 
93 private:
94 
95  void SolveC2();
96  void SolveC3();
97 
102 
104 
107 
110 
113 };
114 
115 #endif
float32 * masses
Definition: b2Rope.h:47
float32 * m_Ls
Definition: b2Rope.h:105
float32 damping
Definition: b2Rope.h:53
float32 m_k2
Definition: b2Rope.h:111
b2RopeDef()
Definition: b2Rope.h:29
float32 m_damping
Definition: b2Rope.h:109
float32 * m_as
Definition: b2Rope.h:106
b2Vec2 m_gravity
Definition: b2Rope.h:108
b2Vec2 gravity
Definition: b2Rope.h:50
void SetZero()
Set this vector to all zeros.
Definition: b2Math.h:62
A 2D column vector.
Definition: b2Math.h:53
float32 k3
Bending stiffness. Values above 0.5 can make the simulation blow up.
Definition: b2Rope.h:59
TFSIMD_FORCE_INLINE tfScalar angle(const Quaternion &q1, const Quaternion &q2)
signed int int32
Definition: b2Settings.h:31
Definition: b2Draw.h:35
float32 k2
Stretching stiffness.
Definition: b2Rope.h:56
int32 GetVertexCount() const
Definition: b2Rope.h:76
int32 m_count
Definition: b2Rope.h:98
b2Vec2 * vertices
Definition: b2Rope.h:41
int32 count
Definition: b2Rope.h:44
float32 m_k3
Definition: b2Rope.h:112
b2Vec2 * m_ps
Definition: b2Rope.h:99
b2Vec2 * m_p0s
Definition: b2Rope.h:100
Definition: b2Rope.h:63
float32 * m_ims
Definition: b2Rope.h:103
const b2Vec2 * GetVertices() const
Definition: b2Rope.h:82
float float32
Definition: b2Settings.h:35
b2Vec2 * m_vs
Definition: b2Rope.h:101


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