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

◆ set_threshold()

void MayaFlux::Nodes::Generator::Logic::set_threshold ( double  threshold,
bool  create_default_direct_function = false 
)

Sets the decision boundary for binary quantization.

Parameters
thresholdValue above which input is considered true
create_default_direct_functionWhether to create a default direct function if none is set

Configures the threshold used to convert continuous input values to binary states (true/false). Critical for accurate digital interpretation of analog-like signals.

Definition at line 305 of file Logic.cpp.

306{
307 m_threshold = threshold;
308 m_high_threshold = threshold;
309 m_low_threshold = threshold * 0.9; // Default hysteresis
310
311 if (m_operator == LogicOperator::THRESHOLD && m_mode == LogicMode::DIRECT && create_default_direct_function) {
312 m_direct_function = [this](double input) {
313 return input > m_threshold;
314 };
315 }
316}
DirectFunction m_direct_function
Function for direct mode.
Definition Logic.hpp:582
double m_threshold
Threshold for boolean conversion.
Definition Logic.hpp:590
double m_high_threshold
High threshold for hysteresis.
Definition Logic.hpp:592
LogicOperator m_operator
Current logic operator.
Definition Logic.hpp:581
double m_low_threshold
Low threshold for hysteresis.
Definition Logic.hpp:591
LogicMode m_mode
Current processing mode.
Definition Logic.hpp:580
@ DIRECT
Stateless evaluation of current input only (combinational logic)
@ THRESHOLD
Binary quantization - true when input exceeds threshold.

References MayaFlux::Nodes::Generator::DIRECT, m_direct_function, m_high_threshold, m_low_threshold, m_mode, m_operator, m_threshold, and MayaFlux::Nodes::Generator::THRESHOLD.