Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008 #ifndef POTENTIALFUNCTIONIMPL_HPP_
00009 #define POTENTIALFUNCTIONIMPL_HPP_
00010
00011 #include <telekyb_defines/telekyb_defines.hpp>
00012 #include <telekyb_calculus/Potentials/PotentialFunctionOptions.hpp>
00013
00014 namespace TELEKYB_NAMESPACE {
00015
00016 namespace PotentialFunctionImpl {
00017
00018 class CoTanRepulsiveGradient {
00019 private:
00020 PotentialFunctionOptions& options;
00021 public:
00022 CoTanRepulsiveGradient(PotentialFunctionOptions& options_) : options(options_) {}
00023 double operator()(double d) const {
00024 double z = (M_PI/2.0) *
00025 ((d - options.tPotFuncInfD->getValue())
00026 / (options.tPotFuncZeroD->getValue() - options.tPotFuncInfD->getValue()));
00027 double cot_z = 1.0/tan(z);
00028 double retValue = (M_PI/2.0) * (1.0 / (options.tPotFuncZeroD->getValue() - options.tPotFuncInfD->getValue())) *
00029 pow((cot_z + z - (M_PI/2.0)),options.tPotFuncGain->getValue());
00030 return retValue;
00031 }
00032 PotentialFunctionType operator()() const {
00033 return PotentialFunctionType::Repulsive;
00034 }
00035 };
00036
00037 class CoTanAttractiveGradient {
00038 private:
00039 PotentialFunctionOptions& options;
00040 public:
00041 CoTanAttractiveGradient(PotentialFunctionOptions& options_) : options(options_) {}
00042 double operator()(double d) const {
00043 double z = (M_PI/2.0) *
00044 ((options.tPotFuncInfD->getValue() - d)
00045 / (options.tPotFuncInfD->getValue() - options.tPotFuncZeroD->getValue()));
00046 double cot_z = 1.0/tan(z);
00047 double retValue = (M_PI/2.0) * (1.0 / (options.tPotFuncInfD->getValue() - options.tPotFuncZeroD->getValue())) *
00048 pow((cot_z + z - (M_PI/2.0)),options.tPotFuncGain->getValue());
00049 return retValue;
00050 }
00051 PotentialFunctionType operator()() const {
00052 return PotentialFunctionType::Attractive;
00053 }
00054 };
00055
00056
00057
00058 class CoTanRepulsiveHassian {
00059 private:
00060 PotentialFunctionOptions& options;
00061 public:
00062 CoTanRepulsiveHassian(PotentialFunctionOptions& options_) : options(options_) {}
00063 double operator()(double d) const {
00064 double z = (M_PI/2.0) *
00065 ((d - options.tPotFuncInfD->getValue())
00066 / (options.tPotFuncZeroD->getValue() - options.tPotFuncInfD->getValue()));
00067 double cot_z = 1.0/tan(z);
00068 double retValue = (M_PI/2.0) * (1.0 / (options.tPotFuncZeroD->getValue() - options.tPotFuncInfD->getValue())) *
00069 options.tPotFuncGain->getValue() *
00070 pow((cot_z + z - (M_PI/2.0)), options.tPotFuncGain->getValue() - 1.0) *
00071 pow(cot_z,2);
00072 return retValue;
00073 }
00074 PotentialFunctionType operator()() const {
00075 return PotentialFunctionType::Repulsive;
00076 }
00077 };
00078
00079 }
00080
00081 }
00082
00083
00084
00085
00086 #endif