 |
Grail (C++)
1.1.1
A multi-platform, modular, universal engine for embedding advanced AI in games.
|
1 #ifndef GRAIL_SINGLE_STEP_FUNCTION_H
2 #define GRAIL_SINGLE_STEP_FUNCTION_H
10 template <
typename ContextType>
27 float beforeThresholdValue,
28 float afterThresholdValue)
29 :
Curve<ContextType>{childEvaluator},
31 beforeThresholdValue{beforeThresholdValue},
32 afterThresholdValue{afterThresholdValue}
36 virtual float Sample(
float argument)
const override final
38 return argument > threshold ? afterThresholdValue : beforeThresholdValue;
57 virtual EvaluatorType GetEvaluatorType() const override final {
return EvaluatorType::CURVE_UNIT_STEP; }
60 float threshold = 0.0f;
61 float beforeThresholdValue = 0.0f;
62 float afterThresholdValue = 0.0f;
67 #endif // GRAIL_SINGLE_STEP_FUNCTION_H
The Curve class - Defines objects transforming one value into the other.
Definition: Curve.hh:19
UnitStepFunction(std::shared_ptr< utility::Evaluator< ContextType >> childEvaluator, float threshold, float beforeThresholdValue, float afterThresholdValue)
UnitStepFunction - Constructor.
Definition: UnitStepFunction.hh:25
The UnitStepFunction class - Unit Step Function.
Definition: UnitStepFunction.hh:15
float GetAfterThresholdValue() const
GetAfterThresholdValue.
Definition: UnitStepFunction.hh:55
float GetBeforeThresholdValue() const
GetBeforeThresholdValue.
Definition: UnitStepFunction.hh:50
The Evaluator class - base class being able to evaluate given context and output the result.
Definition: Evaluator.hh:20
virtual float Sample(float argument) const override final
Sample - Transforms argument into output value depending on the type of Curve.
Definition: UnitStepFunction.hh:36
float GetThreshold() const
GetThreshold.
Definition: UnitStepFunction.hh:45