25 static boost::mt19937 gen(5);
36 sphere[0] = cartesian.lpNorm<2>();
37 sphere[1] = asin(cartesian[2]);
38 sphere[2] = atan2(cartesian[1], cartesian[0]);
48 cartesian[0] = sphere[0] * cos(sphere[1]) * cos(sphere[2]);
49 cartesian[1] = sphere[0] * cos(sphere[1]) * sin(sphere[2]);
50 cartesian[2] = sphere[0] * sin(sphere[1]);
60 resultAxis = orientation.toRotationMatrix() * SimpleVector3::UnitX();
64 return (value == 0 ? 0.0 : (value < 0 ? -1.0 : 1.0));
68 return SimpleVector3((idx == 0 ? 0 : X[0]), (idx == 1 ? 0 : X[1]), (idx == 2 ? 0 : X[2]));
75 if (xNorm == 0 || yNorm == 0) {
78 return X.dot(Y) / xNorm / yNorm;
83 float angle = acos(cosinus);
88 Precision angleDiff = std::fabs(firstAngle - secondAngle);
89 return fmin(angleDiff, 2 * M_PI - angleDiff);
93 boost::uniform_int<> uniform(min, max);
94 boost::variate_generator<boost::mt19937&, boost::uniform_int<> > random(
getRandomnessGenerator(), uniform);
99 boost::normal_distribution<Precision> uniform(mean, standardDeviation);
100 boost::variate_generator<boost::mt19937&, boost::normal_distribution<Precision> > random(
getRandomnessGenerator(), uniform);
107 for (
int i = 0; i < mean.rows(); i++) {
119 double c1 = cos(heading / 2);
120 double c2 = cos(attitude / 2);
121 double c3 = cos(bank / 2);
122 double s1 = sin(heading / 2);
123 double s2 = sin(attitude / 2);
124 double s3 = sin(bank / 2);
133 return result.normalized();
140 float dlong = M_PI * (3.0 - sqrt(5.0));
141 float dz = 2.0 / numberOfPoints;
142 float longitude = 0.0;
143 float z = 1.0 - dz / 2.0;
145 for (
int k = 0; k < numberOfPoints; k += 1) {
146 float r = sqrt(1.0 - pow(z, 2));
149 point[0] = cos(longitude) * r;
150 point[1] = sin(longitude) * r;
155 oritentationCollectionPtr->push_back(orientation);
164 return oritentationCollectionPtr;
169 return fmod(input / M_PI * 180.0, 360);
173 return fmod(input / 180.0 * M_PI, 2 * M_PI);
178 return v1[0]*v2[0] + v1[1]*v2[1] + v1[2]*v2[2];
182 return std::abs(v1[0] - v2[0]) < 0.0001 &&
183 std::abs(v1[1] - v2[1]) < 0.0001 &&
184 std::abs(v1[2] - v2[2]) < 0.0001;
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)
std::vector< SimpleQuaternion, Eigen::aligned_allocator< SimpleQuaternion > > SimpleQuaternionCollection
static Precision getMinimumAngleDifference(const Precision &firstAngle, const Precision &secondAngle)
static SimpleQuaternion getRandomQuaternion()
TFSIMD_FORCE_INLINE tfScalar angle(const Quaternion &q1, const Quaternion &q2)
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 SimpleQuaternion getQuaternionByAngles(const Precision &heading, const Precision &attitude, const Precision &bank)
TFSIMD_FORCE_INLINE const tfScalar & z() const
static double degToRad(double input)
static double getDotProduct(SimpleVector3 v1, SimpleVector3 v2)
static double radToDeg(double input)
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)