Compute the axis-aligned bounding box for all particles contained within this particle system. @param aabb Returns the axis-aligned bounding box of the system.
| 2338 | /// within this particle system. |
| 2339 | /// @param aabb Returns the axis-aligned bounding box of the system. |
| 2340 | void b2ParticleSystem::ComputeAABB(b2AABB* const aabb) const |
| 2341 | { |
| 2342 | const int32 particleCount = GetParticleCount(); |
| 2343 | b2Assert(aabb); |
| 2344 | aabb->lowerBound.x = +b2_maxFloat; |
| 2345 | aabb->lowerBound.y = +b2_maxFloat; |
| 2346 | aabb->upperBound.x = -b2_maxFloat; |
| 2347 | aabb->upperBound.y = -b2_maxFloat; |
| 2348 | |
| 2349 | for (int32 i = 0; i < particleCount; i++) |
| 2350 | { |
| 2351 | b2Vec2 p = m_positionBuffer.data[i]; |
| 2352 | aabb->lowerBound = b2Min(aabb->lowerBound, p); |
| 2353 | aabb->upperBound = b2Max(aabb->upperBound, p); |
| 2354 | } |
| 2355 | aabb->lowerBound.x -= m_particleDiameter; |
| 2356 | aabb->lowerBound.y -= m_particleDiameter; |
| 2357 | aabb->upperBound.x += m_particleDiameter; |
| 2358 | aabb->upperBound.y += m_particleDiameter; |
| 2359 | } |
| 2360 | |
| 2361 | // Associate a memory allocator with this object. |
| 2362 | FixedSetAllocator::FixedSetAllocator( |
no test coverage detected