MayaFlux 0.4.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 553 of file PhysicsOperator.cpp.

554{
556 return;
557 }
558
559 constexpr float damping = 0.8F;
560
561 for (auto& group : m_collections) {
562 auto& points = group.collection->get_points();
563
564 for (size_t i = 0; i < points.size(); ++i) {
565 auto& vertex = points[i];
566 auto& state = group.physics_state[i];
567
568 for (int axis = 0; axis < 3; ++axis) {
569 if (vertex.position[axis] < m_bounds.min[axis]) {
570 switch (m_bounds_mode) {
572 vertex.position[axis] = m_bounds.min[axis];
573 state.velocity[axis] *= -damping;
574 break;
575 case BoundsMode::WRAP:
576 vertex.position[axis] = m_bounds.max[axis];
577 break;
579 vertex.position[axis] = m_bounds.min[axis];
580 state.velocity[axis] = 0.0F;
581 break;
582 case BoundsMode::NONE:
583 break;
584 }
585 } else if (vertex.position[axis] > m_bounds.max[axis]) {
586 switch (m_bounds_mode) {
588 vertex.position[axis] = m_bounds.max[axis];
589 state.velocity[axis] *= -damping;
590 break;
591 case BoundsMode::WRAP:
592 vertex.position[axis] = m_bounds.min[axis];
593 break;
595 vertex.position[axis] = m_bounds.max[axis];
596 state.velocity[axis] = 0.0F;
597 break;
598 case BoundsMode::NONE:
599 break;
600 }
601 }
602 }
603 }
604 }
605}
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: