MayaFlux 0.4.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 318 of file Logic.cpp.

319{
320 m_low_threshold = low_threshold;
321 m_high_threshold = high_threshold;
322 m_threshold = high_threshold; // For compatibility with other methods
323
324 if (m_operator == LogicOperator::HYSTERESIS && m_mode == LogicMode::DIRECT && create_default_direct_function) {
325 m_direct_function = [this](double input) {
326 if (input > m_high_threshold) {
327 m_hysteresis_state = true;
328 } else if (input < m_low_threshold) {
329 m_hysteresis_state = false;
330 }
331 return m_hysteresis_state;
332 };
333 }
334}
Core::GlobalInputConfig input
Definition Config.cpp:36
DirectFunction m_direct_function
Function for direct mode.
Definition Logic.hpp:594
double m_threshold
Threshold for boolean conversion.
Definition Logic.hpp:602
double m_high_threshold
High threshold for hysteresis.
Definition Logic.hpp:604
LogicOperator m_operator
Current logic operator.
Definition Logic.hpp:593
double m_low_threshold
Low threshold for hysteresis.
Definition Logic.hpp:603
bool m_hysteresis_state
State for hysteresis operator.
Definition Logic.hpp:607
LogicMode m_mode
Current processing mode.
Definition Logic.hpp:592
@ 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.