MCPcopy Create free account
hub / github.com/aardappel/lobster / SolveRigid

Method SolveRigid

dev/include/Box2D/Particle/b2ParticleSystem.cpp:3502–3526  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3500}
3501
3502void b2ParticleSystem::SolveRigid(const b2TimeStep& step)
3503{
3504 for (b2ParticleGroup* group = m_groupList; group; group = group->GetNext())
3505 {
3506 if (group->m_groupFlags & b2_rigidParticleGroup)
3507 {
3508 group->UpdateStatistics();
3509 b2Rot rotation(step.dt * group->m_angularVelocity);
3510 b2Transform transform(
3511 group->m_center + step.dt * group->m_linearVelocity -
3512 b2Mul(rotation, group->m_center), rotation);
3513 group->m_transform = b2Mul(transform, group->m_transform);
3514 b2Transform velocityTransform;
3515 velocityTransform.p.x = step.inv_dt * transform.p.x;
3516 velocityTransform.p.y = step.inv_dt * transform.p.y;
3517 velocityTransform.q.s = step.inv_dt * transform.q.s;
3518 velocityTransform.q.c = step.inv_dt * (transform.q.c - 1);
3519 for (int32 i = group->m_firstIndex; i < group->m_lastIndex; i++)
3520 {
3521 m_velocityBuffer.data[i] = b2Mul(velocityTransform,
3522 m_positionBuffer.data[i]);
3523 }
3524 }
3525 }
3526}
3527
3528void b2ParticleSystem::SolveElastic(const b2TimeStep& step)
3529{

Callers

nothing calls this directly

Calls 3

b2MulFunction · 0.85
UpdateStatisticsMethod · 0.80
GetNextMethod · 0.45

Tested by

no test coverage detected