20 #ifndef MATHHELPER_HPP_ 21 #define MATHHELPER_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> 33 #include <geometry_msgs/Quaternion.h> 86 static double getSignum(
const double &value);
160 static double radToDeg(
double input);
166 static double degToRad(
double input);
174 BOOST_FOREACH(
typename Set::value_type value, *setPtr) {
175 std::cout << value <<
", ";
177 std::cout <<
"}" << std::endl;
181 std::cout <<
"{ " << std::endl;
185 std::cout <<
"} " << std::endl;
186 std::cout << powerSetPtr->size() <<
" Items" << std::endl;
192 std::size_t value = 0;
193 assert(setPtr->size() <= 31);
196 std::size_t limit = (1 << setPtr->size());
197 for (std::size_t counter = 0; counter < limit; ++counter) {
200 for (
typename Set::iterator setIter = setPtr->begin(); setIter != setPtr->end(); ++setIter, ++idx) {
201 if ( (value & (1 << idx)) != 0 ) {
202 subSetPtr->insert(*setIter);
205 powerSetPtr->insert(subSetPtr);
218 for (
typename PowerSet::iterator powerSetIter = powerSetPtr->begin(); powerSetIter != powerSetPtr->end(); ++powerSetIter) {
219 if ((*powerSetIter)->size() < min || (*powerSetIter)->size() > max) {
223 resultPowerSetPtr->insert(*powerSetIter);
226 return resultPowerSetPtr;
230 return filterCardinalityPowerSet<PowerSet>(setPtr, min, setPtr->size());
Eigen::Matrix< Precision, Eigen::Dynamic, 1 > SimpleVectorX
static bool vector3Equal(SimpleVector3 v1, SimpleVector3 v2)
SimpleVector3 SimpleSphereCoordinates
static double getSignum(const double &value)
Eigen::Matrix< Precision, 3, 1 > SimpleVector3
static Precision getAngle(const SimpleVector3 &X, const SimpleVector3 &Y)
static Precision getCosinus(const SimpleVector3 &X, const SimpleVector3 &Y)
MathHelper unites the generally needed math operations.
static Precision getMinimumAngleDifference(const Precision &firstAngle, const Precision &secondAngle)
static boost::shared_ptr< PowerSet > filterCardinalityPowerSet(const boost::shared_ptr< PowerSet > &setPtr, const std::size_t min)
static SimpleQuaternion getRandomQuaternion()
static Precision getRandomNumber(const Precision &mean, const Precision &standardDeviation)
this namespace contains all generally usable classes.
static boost::mt19937 & getRandomnessGenerator()
static SimpleVectorX getRandomVector(const SimpleVectorX &mean, const SimpleVectorX &standardDeviation)
static SimpleVector3 getVisualAxis(const SimpleQuaternion &orientation)
static SimpleVector3 getProjection(const std::size_t &idx, const SimpleVector3 &X)
static void printSet(boost::shared_ptr< Set > &setPtr)
static SimpleQuaternion getQuaternionByAngles(const Precision &heading, const Precision &attitude, const Precision &bank)
static double degToRad(double input)
static double getDotProduct(SimpleVector3 v1, SimpleVector3 v2)
static double radToDeg(double input)
static boost::shared_ptr< std::set< boost::shared_ptr< Set > > > powerSet(const boost::shared_ptr< Set > &setPtr)
static void printPowerSet(boost::shared_ptr< std::set< boost::shared_ptr< Set > > > &powerSetPtr)
static boost::shared_ptr< PowerSet > filterCardinalityPowerSet(const boost::shared_ptr< PowerSet > &powerSetPtr, const std::size_t min, const std::size_t max)
Eigen::Quaternion< Precision > SimpleQuaternion
static SimpleSphereCoordinates convertC2S(const SimpleVector3 &cartesian)
converts cartesian coordinates to sphere coordinates
static SimpleVector3 convertS2C(const SimpleSphereCoordinates &sphere)
converts sphere coordinates to cartesian coordinates (lightweight)
static SimpleQuaternionCollectionPtr getOrientationsOnUnitSphere(const int &numberOfPoints)
static int getRandomInteger(const int &min, const int &max)