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

◆ apply_attraction_forces()

void MayaFlux::Nodes::Network::PhysicsOperator::apply_attraction_forces ( )
private

Definition at line 464 of file PhysicsOperator.cpp.

465{
466 for (auto& group : m_collections) {
467 auto& points = group.collection->get_points();
468
469 for (size_t i = 0; i < points.size(); ++i) {
470 glm::vec3 to_attractor = m_attraction_point - points[i].position;
471 float distance = glm::length(to_attractor);
472
473 if (distance > 0.001F) {
474 glm::vec3 direction = to_attractor / distance;
475 float force_magnitude = m_attraction_strength / std::max(distance * distance, 0.1F);
476 group.physics_state[i].force += direction * force_magnitude * group.physics_state[i].mass;
477 }
478 }
479 }
480}
std::vector< CollectionGroup > m_collections

References m_attraction_point, m_attraction_strength, and m_collections.

Referenced by apply_forces().

+ Here is the caller graph for this function: