8 factorAbs(
std::
abs(factor)), offset(offset), negativeFactor(factor < 0)
16 if (other.factorAbs.has_value())
18 factorAbs = other.factorAbs;
21 if (other.negativeFactor.has_value())
23 negativeFactor = other.negativeFactor;
26 if (other.offset.has_value())
28 offset = other.offset;
36 this->factorAbs = std::make_optional(factorAbs);
42 this->offset = std::make_optional(offset);
48 this->negativeFactor = isNegative;
54 return (negativeFactor.value_or(
false) ? -1 : 1) * factorAbs.value_or(1.f);
60 return offset.value_or(0.f);
66 float discontinuityOffset,
69 zeroOffset(zeroOffset),
70 discontinuityOffset(discontinuityOffset),
72 isInverted{isInverted}
80 if (other.zeroOffset.has_value())
82 zeroOffset = other.zeroOffset;
85 if (other.discontinuityOffset.has_value())
87 discontinuityOffset = other.discontinuityOffset;
90 if (other.maxValue.has_value())
92 maxValue = other.maxValue;
95 if (other.isInverted.has_value())
97 isInverted = other.isInverted;
106 this->zeroOffset = zeroOffset;
112 this->isInverted = isInverted;
118 return zeroOffset.value_or(0.f);
124 return discontinuityOffset.value_or(0.f);
130 return maxValue.value_or(0.f);
136 return isInverted.value_or(
false);
The LinearConfig class represents a linear conversion and has a factor and offset.
float getFactor() const
Get the factor.
void setFactorAbsoluteValue(float factorAbs)
Set the absolute value for factor, keep sign unaffected.
LinearConfig(float factor, float offset)
Create LinearConfig with factor and offset.
void setFactorIsNegative(bool isNegative)
Set the new factor sign, keep the factor absolute value unaffected.
LinearConfig overrideWith(LinearConfig)
Perform partial override.
void setOffset(float offset)
Set the offset.
bool getIsInverted() const
void setIsInverted(bool isNegative)
ModularConvertedValueConfig(float zeroOffset, float discontinuityOffset, float maxValue, bool isInverted)
float getZeroOffset() const
ModularConvertedValueConfig()=default
float getDiscontinuityOffset() const
float getMaxValue() const
ModularConvertedValueConfig overrideWith(const ModularConvertedValueConfig &)
void setZeroOffset(float zeroOffset)
std::vector< T > abs(const std::vector< T > &v)