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
117 constant_ = constant;
142 template <
typename First,
typename Second,
typename DataType =
float>
193 DataType operator () (
const DataType& x)
const
195 return (first_(x) + second_(x));
264 template <
typename First,
typename Second,
typename DataType =
float>
315 DataType operator () (
const DataType& x)
const
317 return (first_(x) - second_(x));
371 template <
typename First,
typename Second,
typename DataType =
float>
422 DataType operator () (
const DataType& x)
const
424 return (first_(x) * second_(x));
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);
605 template <
typename Function,
typename DataType =
float>
657 DataType operator () (
const DataType& x)
const
659 DataType val = function_(x);
679 function_ =
function;
703 template <
typename Function,
typename DataType =
float>
754 DataType operator () (
const DataType& x)
const
756 DataType val = function_(x);
769 function_ =
function;
793 template <
typename Function,
typename DataType =
float>
844 DataType operator () (
const DataType& x)
const
846 DataType val = function_(x);
847 return val * val * val;
859 function_ =
function;
883 template <
typename Function,
typename DataType =
float>
934 DataType operator () (
const DataType& x)
const
936 return pow(function_(x), exponent_);
948 function_ =
function;
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
bool operator==(const SquareFunction< Function, DataType > &square) const
void setFunction(const Function &function)
#define BALL_CREATE(name)
void setFirst(const First &first)
const Function & getFunction() const
Division< First, Second, DataType > & operator=(const Division< First, Second, DataType > &division)
void setSecond(const Second &second)
Subtraction< First, Second, DataType > & operator=(const Subtraction< First, Second, DataType > &subtraction)
bool operator==(const Addition< First, Second, DataType > &addition) const
bool operator==(const Product< First, Second, DataType > &product) const
Product< First, Second, DataType > & operator=(const Product< First, Second, DataType > &product)
const Function & getFunction() const
bool operator==(const Subtraction< First, Second, DataType > &subtraction) const
void setExponent(DataType exp)
const First & getFirst() const
void setFunction(const Function &function)
void setConstant(DataType constant)
virtual ~MutableConstant()
void setFirst(const First &first)
const DataType & getConstant() const
void setSecond(const Second &second)
void setSecond(const Second &second)
const Second & getSecond() const
bool operator==(const MutablePower< Function, DataType > &power) const
virtual ~SquareFunction()
void setFunction(const Function &function)
CubicFunction< Function, DataType > & operator=(const CubicFunction< Function, DataType > &cubic)
SquareFunction< Function, DataType > & operator=(const SquareFunction< Function, DataType > &square)
BALL_EXPORT bool operator==(const String &s1, const String &s2)
bool operator==(const CubicFunction< Function, DataType > &cubic) const
bool operator==(const Division< First, Second, DataType > &division) const
void setSecond(const Second &second)
const Function & getFunction() const
const Function & getFunction() const
void setFirst(const First &first)
void setFunction(const Function &function)
Addition< First, Second, DataType > & operator=(const Addition< First, Second, DataType > &addition)
Reciprocal< Function, DataType > & operator=(const Reciprocal< Function, DataType > &reciprocal)
void setFirst(const First &first)
const First & getFirst() const
DataType getExponent() const
bool operator==(const Reciprocal< Function, DataType > &reciprocal) const
MutablePower< Function, DataType > & operator=(const MutablePower< Function, DataType > &power)