Main Page
Namespaces
Classes
Files
File List
File Members
externals
Box2D
Box2D
Rope
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
{
29
b2RopeDef
()
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
41
b2Vec2
*
vertices
;
42
44
int32
count
;
45
47
float32
*
masses
;
48
50
b2Vec2
gravity
;
51
53
float32
damping
;
54
56
float32
k2
;
57
59
float32
k3
;
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
76
int32
GetVertexCount
()
const
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
98
int32
m_count
;
99
b2Vec2
*
m_ps
;
100
b2Vec2
*
m_p0s
;
101
b2Vec2
*
m_vs
;
102
103
float32
*
m_ims
;
104
105
float32
*
m_Ls
;
106
float32
*
m_as
;
107
108
b2Vec2
m_gravity
;
109
float32
m_damping
;
110
111
float32
m_k2
;
112
float32
m_k3
;
113
};
114
115
#endif
b2RopeDef::masses
float32 * masses
Definition:
b2Rope.h:47
b2Rope::m_Ls
float32 * m_Ls
Definition:
b2Rope.h:105
b2Math.h
b2RopeDef::damping
float32 damping
Definition:
b2Rope.h:53
b2Rope::m_k2
float32 m_k2
Definition:
b2Rope.h:111
b2RopeDef::b2RopeDef
b2RopeDef()
Definition:
b2Rope.h:29
b2Rope::m_damping
float32 m_damping
Definition:
b2Rope.h:109
b2Rope::m_as
float32 * m_as
Definition:
b2Rope.h:106
b2Rope::m_gravity
b2Vec2 m_gravity
Definition:
b2Rope.h:108
b2RopeDef::gravity
b2Vec2 gravity
Definition:
b2Rope.h:50
b2Vec2::SetZero
void SetZero()
Set this vector to all zeros.
Definition:
b2Math.h:62
b2Vec2
A 2D column vector.
Definition:
b2Math.h:53
b2RopeDef::k3
float32 k3
Bending stiffness. Values above 0.5 can make the simulation blow up.
Definition:
b2Rope.h:59
angle
TFSIMD_FORCE_INLINE tfScalar angle(const Quaternion &q1, const Quaternion &q2)
int32
signed int int32
Definition:
b2Settings.h:31
b2Draw
Definition:
b2Draw.h:35
b2RopeDef::k2
float32 k2
Stretching stiffness.
Definition:
b2Rope.h:56
b2Rope::GetVertexCount
int32 GetVertexCount() const
Definition:
b2Rope.h:76
b2Rope::m_count
int32 m_count
Definition:
b2Rope.h:98
b2RopeDef::vertices
b2Vec2 * vertices
Definition:
b2Rope.h:41
b2RopeDef::count
int32 count
Definition:
b2Rope.h:44
b2Rope::m_k3
float32 m_k3
Definition:
b2Rope.h:112
b2RopeDef
Definition:
b2Rope.h:27
b2Rope::m_ps
b2Vec2 * m_ps
Definition:
b2Rope.h:99
b2Rope::m_p0s
b2Vec2 * m_p0s
Definition:
b2Rope.h:100
b2Rope
Definition:
b2Rope.h:63
b2Rope::m_ims
float32 * m_ims
Definition:
b2Rope.h:103
b2Rope::GetVertices
const b2Vec2 * GetVertices() const
Definition:
b2Rope.h:82
float32
float float32
Definition:
b2Settings.h:35
b2Rope::m_vs
b2Vec2 * m_vs
Definition:
b2Rope.h:101
mvsim
Author(s):
autogenerated on Thu Jun 6 2019 19:36:40