| 683 | */ |
| 684 | template<typename Scalar, int Options> |
| 685 | EIGEN_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 |
nothing calls this directly
no test coverage detected