5 #ifndef BALL_MATHS_FUNCTION_H
6 #define BALL_MATHS_FUNCTION_H
19 template <
int constant_
template>
35 float operator () (
float )
const
37 return constant_template;
48 template <
typename DataType =
float>
103 DataType operator () (
const DataType& )
const
115 void setConstant(DataType constant)
117 constant_ = constant;
123 const DataType& getConstant()
const
142 template <
typename First,
typename Second,
typename DataType =
float>
193 DataType operator () (
const DataType& x)
const
195 return (first_(x) + second_(x));
205 void setFirst(
const First& first)
220 const First& getFirst()
const
227 void setSecond(
const Second& second)
242 const Second& getSecond()
const
264 template <
typename First,
typename Second,
typename DataType =
float>
315 DataType operator () (
const DataType& x)
const
317 return (first_(x) - second_(x));
327 void setFirst(
const First& first)
342 void setSecond(
const Second& second)
371 template <
typename First,
typename Second,
typename DataType =
float>
422 DataType operator () (
const DataType& x)
const
424 return (first_(x) * second_(x));
434 void setFirst(
const First& first)
450 const First& getFirst()
const
458 void setSecond(
const Second& second)
488 template <
typename First,
typename Second,
typename DataType =
float>
540 DataType operator () (
const DataType& x)
const
542 DataType val = second_(x);
545 return (first_(x) / val);
560 void setFirst(
const First& first)
575 void setSecond(
const Second& second)
605 template <
typename Function,
typename DataType =
float>
657 DataType operator () (
const DataType& x)
const
659 DataType val = function_(x);
677 void setFunction(
const Function&
function)
679 function_ =
function;
685 const Function& getFunction()
const
703 template <
typename Function,
typename DataType =
float>
754 DataType operator () (
const DataType& x)
const
756 DataType val = function_(x);
767 void setFunction(
const Function&
function)
769 function_ =
function;
775 const Function& getFunction()
const
793 template <
typename Function,
typename DataType =
float>
844 DataType operator () (
const DataType& x)
const
846 DataType val = function_(x);
847 return val * val * val;
857 void setFunction(
const Function&
function)
859 function_ =
function;
865 const Function& getFunction()
const
883 template <
typename Function,
typename DataType =
float>
934 DataType operator () (
const DataType& x)
const
936 return pow(function_(x), exponent_);
946 void setFunction(
const Function&
function)
948 function_ =
function;
954 const Function& getFunction()
const
962 void setExponent(DataType exp);
967 DataType getExponent()
const;
983 template <
typename DataType>
990 template <
typename DataType>
998 template <
typename DataType>
1001 : constant_(constant)
1005 template <
typename DataType>
1011 template <
typename DataType>
1020 template <
typename DataType>
1025 return (constant_ == constant.
constant_);
1029 template <
typename First,
typename Second,
typename DataType>
1037 template <
typename First,
typename Second,
typename DataType>
1040 : first_(addition.first_),
1041 second_(addition.second_)
1045 template <
typename First,
typename Second,
typename DataType>
1051 template <
typename First,
typename Second,
typename DataType>
1055 first_ = addition.
first_;
1060 template <
typename First,
typename Second,
typename DataType>
1064 return ((first_ == addition.
first_) && (second_ == addition.
second_));
1068 template <
typename First,
typename Second,
typename DataType>
1076 template <
typename First,
typename Second,
typename DataType>
1079 : first_(subtraction.first_),
1080 second_(subtraction.second_)
1084 template <
typename First,
typename Second,
typename DataType>
1090 template <
typename First,
typename Second,
typename DataType>
1094 first_ = subtraction.
first_;
1095 second_ = subtraction.
second_;
1099 template <
typename First,
typename Second,
typename DataType>
1103 return ((first_ == subtraction.
first_) && (second_ == subtraction.
second_));
1107 template <
typename First,
typename Second,
typename DataType>
1115 template <
typename First,
typename Second,
typename DataType>
1118 : first_(product.first_),
1119 second_(product.second_)
1123 template <
typename First,
typename Second,
typename DataType>
1129 template <
typename First,
typename Second,
typename DataType>
1138 template <
typename First,
typename Second,
typename DataType>
1142 return ((first_ == product.
first_) && (second_ == product.
second_));
1146 template <
typename First,
typename Second,
typename DataType>
1154 template <
typename First,
typename Second,
typename DataType>
1157 : first_(division.first_),
1158 second_(division.second_)
1162 template <
typename First,
typename Second,
typename DataType>
1168 template <
typename First,
typename Second,
typename DataType>
1172 first_ = division.
first_;
1177 template <
typename First,
typename Second,
typename DataType>
1181 return ((first_ == division.
first_) && (second_ == division.
second_));
1185 template <
typename Function,
typename DataType>
1192 template <
typename Function,
typename DataType>
1195 : function_(square.function_)
1199 template <
typename Function,
typename DataType>
1205 template <
typename Function,
typename DataType>
1213 template <
typename Function,
typename DataType>
1221 template <
typename Function,
typename DataType>
1228 template <
typename Function,
typename DataType>
1231 : function_(cubic.function_)
1235 template <
typename Function,
typename DataType>
1241 template <
typename Function,
typename DataType>
1249 template <
typename Function,
typename DataType>
1257 template <
typename Function,
typename DataType>
1264 template <
typename Function,
typename DataType>
1267 : function_(reciprocal.function_)
1271 template <
typename Function,
typename DataType>
1277 template <
typename Function,
typename DataType>
1285 template <
typename Function,
typename DataType>
1289 return (function_ == reciprocal.
function_);
1293 template <
typename Function,
typename DataType>
1301 template <
typename Function,
typename DataType>
1304 : function_(power.function_),
1305 exponent_(power.exponent_)
1309 template <
typename Function,
typename DataType>
1315 template <
typename Function,
typename DataType>
1324 template <
typename Function,
typename DataType>
1332 template <
typename Function,
typename DataType>
1339 template <
typename Function,
typename DataType>
1347 #endif // BALL_MATHS_FUNCTION_H