MayaFlux 0.2.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 501 of file PhysicsOperator.cpp.

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