MCPcopy Create free account
hub / github.com/TinyMPC/TinyMPC / UnitRandom

Method UnitRandom

include/Eigen/Eigen/src/Geometry/Quaternion.h:685–696  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

683 */
684template<typename Scalar, int Options>
685EIGEN_DEVICE_FUNC Quaternion<Scalar,Options> Quaternion<Scalar,Options>::UnitRandom()
686{
687 EIGEN_USING_STD(sqrt)
688 EIGEN_USING_STD(sin)
689 EIGEN_USING_STD(cos)
690 const Scalar u1 = internal::random<Scalar>(0, 1),
691 u2 = internal::random<Scalar>(0, 2*EIGEN_PI),
692 u3 = internal::random<Scalar>(0, 2*EIGEN_PI);
693 const Scalar a = sqrt(Scalar(1) - u1),
694 b = sqrt(u1);
695 return Quaternion (a * sin(u2), a * cos(u2), b * sin(u3), b * cos(u3));
696}
697
698
699/** Returns a quaternion representing a rotation between

Callers

nothing calls this directly

Calls 4

QuaternionClass · 0.70
sqrtFunction · 0.50
sinFunction · 0.50
cosFunction · 0.50

Tested by

no test coverage detected