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 508 of file PhysicsOperator.cpp.

509{
511 return;
512 }
513
514 constexpr float damping = 0.8F;
515
516 for (auto& group : m_collections) {
517 auto& points = group.collection->get_points();
518
519 for (size_t i = 0; i < points.size(); ++i) {
520 auto& vertex = points[i];
521 auto& state = group.physics_state[i];
522
523 for (int axis = 0; axis < 3; ++axis) {
524 if (vertex.position[axis] < m_bounds.min[axis]) {
525 switch (m_bounds_mode) {
527 vertex.position[axis] = m_bounds.min[axis];
528 state.velocity[axis] *= -damping;
529 break;
530 case BoundsMode::WRAP:
531 vertex.position[axis] = m_bounds.max[axis];
532 break;
534 vertex.position[axis] = m_bounds.min[axis];
535 state.velocity[axis] = 0.0F;
536 break;
537 case BoundsMode::NONE:
538 break;
539 }
540 } else if (vertex.position[axis] > m_bounds.max[axis]) {
541 switch (m_bounds_mode) {
543 vertex.position[axis] = m_bounds.max[axis];
544 state.velocity[axis] *= -damping;
545 break;
546 case BoundsMode::WRAP:
547 vertex.position[axis] = m_bounds.min[axis];
548 break;
550 vertex.position[axis] = m_bounds.max[axis];
551 state.velocity[axis] = 0.0F;
552 break;
553 case BoundsMode::NONE:
554 break;
555 }
556 }
557 }
558 }
559 }
560}
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, and WRAP.

Referenced by process().

+ Here is the caller graph for this function: