Grail (C++)  1.1.1
A multi-platform, modular, universal engine for embedding advanced AI in games.
grail::curves::LinearFunction< ContextType > Class Template Referencefinal

The LinearFunction class - Linear Function. More...

#include <LinearFunction.hh>

Inheritance diagram for grail::curves::LinearFunction< ContextType >:
Collaboration diagram for grail::curves::LinearFunction< ContextType >:

Public Member Functions

 LinearFunction (std::shared_ptr< utility::Evaluator< ContextType >> childEvaluator, float slope, float intercept)
 LinearFunction - Constructor. More...
 
 LinearFunction (std::shared_ptr< utility::Evaluator< ContextType >> childEvaluator, std::pair< float, float > firstPoint, std::pair< float, float > secondPoint)
 LinearFunction - Constructor. More...
 
virtual float Sample (float argument) const override final
 Sample - Transforms argument into output value depending on the type of Curve. More...
 
float GetSlope () const
 GetSlope. More...
 
float GetIntercept () const
 GetIntercept. More...
 
virtual EvaluatorType GetEvaluatorType () const override final
 
- Public Member Functions inherited from grail::curves::Curve< ContextType >
 Curve (std::shared_ptr< utility::Evaluator< ContextType >> childEvaluator)
 Curve - Constructor. More...
 
 Curve (const Curve< ContextType > &other)=default
 
 Curve (Curve< ContextType > &&other)=default
 
virtual float Evaluate (const ContextType &context, UtilityEvaluatorSnapshot *const snapshot) const override final
 Evaluate - Called from EvaluateContext which also evaluates context, but without automatically filling snapshot with debug data. Should be overriden for each derived Evaluator. More...
 
- Public Member Functions inherited from grail::utility::Evaluator< ContextType >
float EvaluateContext (const ContextType &context, UtilityEvaluatorSnapshot *const snapshot) const
 EvaluateContext - evaluates provided context and if provided snapshot is not empty, fills it with debug data describing this node. More...
 

Additional Inherited Members

- Protected Member Functions inherited from grail::curves::Curve< ContextType >
virtual void DebugDump (const std::map< const void *, std::size_t > &nodeMapping, EvaluationDebugData &debugData) const override final
 DebugDump - Called from EvaluateContext, which generates additional debug data for each evaluator. Should be overriden in each derived evaluator to better reflect debug tree topology. More...
 

Detailed Description

template<typename ContextType>
class grail::curves::LinearFunction< ContextType >

The LinearFunction class - Linear Function.

Template Parameters
ContextType- Type of evaluated object. By default - ValueTuple(AIEntity, Blackboard).

Constructor & Destructor Documentation

◆ LinearFunction() [1/2]

template<typename ContextType >
grail::curves::LinearFunction< ContextType >::LinearFunction ( std::shared_ptr< utility::Evaluator< ContextType >>  childEvaluator,
float  slope,
float  intercept 
)
inline

LinearFunction - Constructor.

Parameters
childEvaluator-Evaluator which output will be transformed by this curve.
slope- "a" parameter of linear function.
intercept- "b" parameter of linear function.

◆ LinearFunction() [2/2]

template<typename ContextType >
grail::curves::LinearFunction< ContextType >::LinearFunction ( std::shared_ptr< utility::Evaluator< ContextType >>  childEvaluator,
std::pair< float, float >  firstPoint,
std::pair< float, float >  secondPoint 
)
inline

LinearFunction - Constructor.

Parameters
childEvaluator- Evaluator which output will be transformed by this curve.
firstPoint- Beginning of the segment describing linear function.
secondPoint- End of the segment describing linear function.

Member Function Documentation

◆ GetIntercept()

template<typename ContextType >
float grail::curves::LinearFunction< ContextType >::GetIntercept ( ) const
inline

GetIntercept.

Returns
"b" parameter of linear function.

◆ GetSlope()

template<typename ContextType >
float grail::curves::LinearFunction< ContextType >::GetSlope ( ) const
inline

GetSlope.

Returns
"a" parameter of linear function.

◆ Sample()

template<typename ContextType >
virtual float grail::curves::LinearFunction< ContextType >::Sample ( float  argument) const
inlinefinaloverridevirtual

Sample - Transforms argument into output value depending on the type of Curve.

Parameters
argument- Value of a curve argument belonging to its domain.
Returns
Transformed argument.

Implements grail::curves::Curve< ContextType >.


The documentation for this class was generated from the following file: