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

◆ set_hysteresis()

void MayaFlux::Nodes::Generator::Logic::set_hysteresis ( double  low_threshold,
double  high_threshold,
bool  create_default_direct_function = false 
)

Configures noise-resistant binary quantization with memory.

Parameters
low_thresholdValue below which input becomes false
high_thresholdValue above which input becomes true
create_default_direct_functionWhether to create a default direct function if none is set

Implements a Schmitt trigger with separate thresholds for rising and falling transitions, preventing rapid oscillation when input hovers near the threshold. Essential for stable binary quantization of noisy signals.

Definition at line 449 of file Logic.cpp.

450{
451 m_low_threshold = low_threshold;
452 m_high_threshold = high_threshold;
453 m_threshold = high_threshold; // For compatibility with other methods
454
455 if (m_operator == LogicOperator::HYSTERESIS && m_mode == LogicMode::DIRECT && create_default_direct_function) {
456 m_direct_function = [this](double input) {
457 if (input > m_high_threshold) {
458 m_hysteresis_state = true;
459 } else if (input < m_low_threshold) {
460 m_hysteresis_state = false;
461 }
462 return m_hysteresis_state;
463 };
464 }
465}
Core::GlobalInputConfig input
Definition Config.cpp:42
DirectFunction m_direct_function
Function for direct mode.
Definition Logic.hpp:696
double m_threshold
Threshold for boolean conversion.
Definition Logic.hpp:704
double m_high_threshold
High threshold for hysteresis.
Definition Logic.hpp:706
LogicOperator m_operator
Current logic operator.
Definition Logic.hpp:695
double m_low_threshold
Low threshold for hysteresis.
Definition Logic.hpp:705
bool m_hysteresis_state
State for hysteresis operator.
Definition Logic.hpp:709
LogicMode m_mode
Current processing mode.
Definition Logic.hpp:694
@ DIRECT
Stateless evaluation of current input only (combinational logic)
@ HYSTERESIS
Threshold with memory - prevents rapid oscillation at boundary.

References MayaFlux::Nodes::Generator::DIRECT, MayaFlux::Nodes::Generator::HYSTERESIS, input, m_direct_function, m_high_threshold, m_hysteresis_state, m_low_threshold, m_mode, m_operator, and m_threshold.