MayaFlux 1.0.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 721 of file PhysicsOperator.cpp.

722{
724 return;
725 }
726
727 constexpr float damping = 0.8F;
728
729 for (auto& group : m_collections) {
730 auto& points = group.collection->get_points();
731
732 for (size_t i = 0; i < points.size(); ++i) {
733 auto& vertex = points[i];
734 auto& state = group.physics_state[i];
735
736 for (int axis = 0; axis < 3; ++axis) {
737 if (vertex.position[axis] < m_bounds.min[axis]) {
738 switch (m_bounds_mode) {
740 vertex.position[axis] = m_bounds.min[axis];
741 state.velocity[axis] *= -damping;
742 break;
743 case BoundsMode::WRAP:
744 vertex.position[axis] = m_bounds.max[axis];
745 break;
747 vertex.position[axis] = m_bounds.min[axis];
748 state.velocity[axis] = 0.0F;
749 break;
750 case BoundsMode::NONE:
751 break;
752 }
753 } else if (vertex.position[axis] > m_bounds.max[axis]) {
754 switch (m_bounds_mode) {
756 vertex.position[axis] = m_bounds.max[axis];
757 state.velocity[axis] *= -damping;
758 break;
759 case BoundsMode::WRAP:
760 vertex.position[axis] = m_bounds.min[axis];
761 break;
763 vertex.position[axis] = m_bounds.max[axis];
764 state.velocity[axis] = 0.0F;
765 break;
766 case BoundsMode::NONE:
767 break;
768 }
769 }
770 }
771 }
772 }
773}
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: