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

◆ handle_boundary_conditions()

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

Definition at line 690 of file PhysicsOperator.cpp.

691{
693 return;
694 }
695
696 constexpr float damping = 0.8F;
697
698 for (auto& group : m_collections) {
699 auto& points = group.collection->get_points();
700
701 for (size_t i = 0; i < points.size(); ++i) {
702 auto& vertex = points[i];
703 auto& state = group.physics_state[i];
704
705 for (int axis = 0; axis < 3; ++axis) {
706 if (vertex.position[axis] < m_bounds.min[axis]) {
707 switch (m_bounds_mode) {
709 vertex.position[axis] = m_bounds.min[axis];
710 state.velocity[axis] *= -damping;
711 break;
712 case BoundsMode::WRAP:
713 vertex.position[axis] = m_bounds.max[axis];
714 break;
716 vertex.position[axis] = m_bounds.min[axis];
717 state.velocity[axis] = 0.0F;
718 break;
719 case BoundsMode::NONE:
720 break;
721 }
722 } else if (vertex.position[axis] > m_bounds.max[axis]) {
723 switch (m_bounds_mode) {
725 vertex.position[axis] = m_bounds.max[axis];
726 state.velocity[axis] *= -damping;
727 break;
728 case BoundsMode::WRAP:
729 vertex.position[axis] = m_bounds.min[axis];
730 break;
732 vertex.position[axis] = m_bounds.max[axis];
733 state.velocity[axis] = 0.0F;
734 break;
735 case BoundsMode::NONE:
736 break;
737 }
738 }
739 }
740 }
741 }
742}
std::vector< glm::vec2 > * points
std::vector< CollectionGroup > m_collections
@ BOUNCE
Reflect off boundaries with damping.

References BOUNCE, CLAMP, m_bounds, m_bounds_mode, m_collections, MayaFlux::Kinesis::SamplerBounds::max, MayaFlux::Kinesis::SamplerBounds::min, NONE, points, and WRAP.

Referenced by process().

+ Here is the caller graph for this function: