MayaFlux 1.0.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches

◆ get_total_mass()

float MayaFlux::Nodes::Network::PhysicsOperator::get_total_mass ( ) const

Sum of every particle's accreted mass.

Returns
particle count before bonds have ever synced (each particle starts at mass 1.0), and exactly that same value forever after, since transfer neither creates nor destroys mass. Useful as a caller's own reference point for what fraction of the whole system a given body currently represents.

Definition at line 661 of file PhysicsOperator.cpp.

662{
663 if (m_accreted_mass.empty()) {
664 float count = 0.0F;
665 for (const auto& group : m_collections) {
666 count += static_cast<float>(group.collection->get_point_count());
667 }
668 return count;
669 }
670
671 float total = 0.0F;
672 for (float mass : m_accreted_mass) {
673 total += mass;
674 }
675 return total;
676}
uint32_t total
size_t count
std::vector< CollectionGroup > m_collections
std::vector< float > m_accreted_mass
Lazily seeded to 1.0 per particle; see sync_bonds_from_claims.

References count, m_accreted_mass, m_collections, and total.