20 #ifndef MYMATHHELPER_HPP_ 21 #define MYMATHHELPER_HPP_ 24 #include <boost/math/special_functions/binomial.hpp> 25 #include <boost/random/mersenne_twister.hpp> 26 #include <boost/random/uniform_int.hpp> 27 #include <boost/random/uniform_real.hpp> 28 #include <boost/random/normal_distribution.hpp> 29 #include <boost/random/variate_generator.hpp> 30 #include <boost/foreach.hpp> 34 #include <geometry_msgs/Quaternion.h> 87 static double getSignum(
const double &value);
161 static double radToDeg(
double input);
167 static double degToRad(
double input);
173 BOOST_FOREACH(
typename Set::value_type value, *setPtr) {
174 std::cout << value <<
", ";
176 std::cout <<
"}" << std::endl;
180 std::cout <<
"{ " << std::endl;
184 std::cout <<
"} " << std::endl;
185 std::cout << powerSetPtr->size() <<
" Items" << std::endl;
191 std::size_t value = 0;
192 assert(setPtr->size() <= 31);
195 std::size_t limit = (1 << setPtr->size());
196 for (std::size_t counter = 0; counter < limit; ++counter) {
199 for (
typename Set::iterator setIter = setPtr->begin(); setIter != setPtr->end(); ++setIter, ++idx) {
200 if ( (value & (1 << idx)) != 0 ) {
201 subSetPtr->insert(*setIter);
204 powerSetPtr->insert(subSetPtr);
217 for (
typename PowerSet::iterator powerSetIter = powerSetPtr->begin(); powerSetIter != powerSetPtr->end(); ++powerSetIter) {
218 if ((*powerSetIter)->size() < min || (*powerSetIter)->size() > max) {
222 resultPowerSetPtr->insert(*powerSetIter);
225 return resultPowerSetPtr;
229 return filterCardinalityPowerSet<PowerSet>(setPtr, min, setPtr->size());
static SimpleQuaternion getRandomQuaternion()
static void printPowerSet(boost::shared_ptr< std::set< boost::shared_ptr< Set > > > &powerSetPtr)
static SimpleVector3 convertS2C(const SimpleSphereCoordinates &sphere)
converts sphere coordinates to cartesian coordinates (lightweight)
static double degToRad(double input)
static boost::mt19937 & getRandomnessGenerator()
MathHelper unites the generally needed math operations.
static Precision getRandomNumber(const Precision &mean, const Precision &standardDeviation)
Eigen::Matrix< Precision, 3, 1 > SimpleVector3
static double getSignum(const double &value)
static SimpleVector3 getVisualAxis(const SimpleQuaternion &orientation)
SimpleVector3 SimpleSphereCoordinates
static boost::shared_ptr< std::set< boost::shared_ptr< Set > > > powerSet(const boost::shared_ptr< Set > &setPtr)
static double radToDeg(double input)
static SimpleVector3 getProjection(const std::size_t &idx, const SimpleVector3 &X)
Eigen::Matrix< Precision, Eigen::Dynamic, 1 > SimpleVectorX
static boost::shared_ptr< PowerSet > filterCardinalityPowerSet(const boost::shared_ptr< PowerSet > &setPtr, const std::size_t min)
static Precision getCosinus(const SimpleVector3 &X, const SimpleVector3 &Y)
this namespace contains all generally usable classes.
static SimpleVectorX getRandomVector(const SimpleVectorX &mean, const SimpleVectorX &standardDeviation)
static SimpleQuaternionCollectionPtr getOrientationsOnUnitSphere(const int &numberOfPoints)
static Precision getMinimumAngleDifference(const Precision &firstAngle, const Precision &secondAngle)
static SimpleSphereCoordinates convertC2S(const SimpleVector3 &cartesian)
converts cartesian coordinates to sphere coordinates
static int getRandomInteger(const int &min, const int &max)
static boost::shared_ptr< PowerSet > filterCardinalityPowerSet(const boost::shared_ptr< PowerSet > &powerSetPtr, const std::size_t min, const std::size_t max)
static Precision getAngle(const SimpleVector3 &X, const SimpleVector3 &Y)
static SimpleQuaternion getQuaternionByAngles(const Precision &heading, const Precision &attitude, const Precision &bank)
static double getDotProduct(SimpleVector3 v1, SimpleVector3 v2)
static void printSet(boost::shared_ptr< Set > &setPtr)
Eigen::Quaternion< Precision > SimpleQuaternion