72 int32 count2 = m_count - 1;
73 int32 count3 = m_count - 2;
77 for (
int32 i = 0; i < count2; ++i)
84 for (
int32 i = 0; i < count3; ++i)
126 for (
int32 i = 0; i < iterations; ++i)
144 for (
int32 i = 0; i < count2; ++i)
155 if (im1 + im2 == 0.0
f)
163 p1 -=
m_k2 * s1 * (
m_Ls[i] - L) * d;
164 p2 +=
m_k2 * s2 * (
m_Ls[i] - L) * d;
174 for (
int32 i = 0; i < count3; ++i)
184 for (
int32 i = 0; i < count3; ++i)
200 if (L1sqr * L2sqr == 0.0
f)
235 angle += 2.0f *
b2_pi;
241 p1 += (m1 * impulse) * J1;
242 p2 += (m2 * impulse) * J2;
243 p3 += (m3 * impulse) * J3;
GLboolean GLboolean GLboolean GLboolean a
virtual void DrawSegment(const b2Vec2 &p1, const b2Vec2 &p2, const b2Color &color)=0
Draw a line segment.
float32 b2Dot(const b2Vec2 &a, const b2Vec2 &b)
Perform the dot product on two vectors.
void SetAngle(float32 angle)
float32 LengthSquared() const
void SetZero()
Set this vector to all zeros.
float32 k3
Bending stiffness. Values above 0.5 can make the simulation blow up.
Color for debug drawing. Each value has the range [0,1].
void Step(float32 timeStep, int32 iterations)
float32 b2Cross(const b2Vec2 &a, const b2Vec2 &b)
Perform the cross product on two vectors. In 2D this produces a scalar.
void Initialize(const b2RopeDef *def)
float32 k2
Stretching stiffness.
void Draw(b2Draw *draw) const
void b2Distance(b2DistanceOutput *output, b2SimplexCache *cache, const b2DistanceInput *input)
b2Vec2 Skew() const
Get the skew vector such that dot(skew_vec, other) == cross(vec, other)
void * b2Alloc(int32 size)
Implement this function to use your own memory allocator.
GLdouble GLdouble GLdouble b
float32 Normalize()
Convert this vector into a unit vector. Returns the length.
void b2Free(void *mem)
If you implement b2Alloc, you should also implement this function.
GLdouble GLdouble GLdouble GLdouble GLdouble GLdouble f