MCPcopy Create free account
hub / github.com/InteractiveComputerGraphics/SPlisHSPlasH / removeParticles

Function removeParticles

Tools/FoamGenerator/main.cpp:1573–1597  ·  view source on GitHub ↗

Remove foam particles which are at the end of their lifetime. */

Source from the content-addressed store, hash-verified

1571/** Remove foam particles which are at the end of their lifetime.
1572*/
1573void removeParticles()
1574{
1575 unsigned int removedParticles = 0;
1576 for (int i = 0; i < (int)fx.size(); i++)
1577 {
1578 if (flifetime[i] <= 0.0)
1579 {
1580 removedParticles++;
1581 }
1582 else
1583 {
1584 fx[i - removedParticles] = fx[i];
1585 fv[i - removedParticles] = fv[i];
1586 flifetime[i - removedParticles] = flifetime[i];
1587 particleType[i - removedParticles] = particleType[i];
1588 }
1589 }
1590 if (removedParticles > 0)
1591 {
1592 fx.resize(fx.size() - removedParticles);
1593 fv.resize(fv.size() - removedParticles);
1594 flifetime.resize(flifetime.size() - removedParticles);
1595 particleType.resize(particleType.size() - removedParticles);
1596 }
1597}
1598
1599/** Read particle data from a partio file.
1600*/

Callers 1

generateFoamFilesFunction · 0.85

Calls 2

sizeMethod · 0.45
resizeMethod · 0.45

Tested by

no test coverage detected