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

◆ rebuild_spatial_neighbors()

void MayaFlux::Nodes::Network::ParticleNetwork::rebuild_spatial_neighbors ( )
private

Rebuild neighbor map for SPATIAL topology.

Definition at line 508 of file ParticleNetwork.cpp.

509{
510 m_neighbor_map.clear();
511
512 // Simple O(n²) spatial query - could be optimized with spatial hash
513 for (size_t i = 0; i < m_particles.size(); ++i) {
514 glm::vec3 pos_i = m_particles[i].point->get_position();
515
516 for (size_t j = i + 1; j < m_particles.size(); ++j) {
517 glm::vec3 pos_j = m_particles[j].point->get_position();
518 float distance = glm::length(pos_j - pos_i);
519
520 if (distance < m_interaction_radius) {
521 m_neighbor_map[i].push_back(j);
522 m_neighbor_map[j].push_back(i);
523 }
524 }
525 }
526
527 m_neighbor_map_dirty = false;
528
530 "Rebuilt spatial neighbor map: {} particles with neighbors",
531 m_neighbor_map.size());
532}
#define MF_DEBUG(comp, ctx,...)
std::unordered_map< size_t, std::vector< size_t > > m_neighbor_map
@ NodeProcessing
Node graph processing (Nodes::NodeGraphManager)
@ Nodes
DSP Generator and Filter Nodes, graph pipeline, node management.

References m_interaction_radius, m_neighbor_map, m_neighbor_map_dirty, m_particles, MF_DEBUG, MayaFlux::Journal::NodeProcessing, and MayaFlux::Journal::Nodes.

Referenced by apply_interaction_forces(), and initialize().

+ Here is the caller graph for this function: