mirror of
https://gitlab.com/libeigen/eigen.git
synced 2026-04-10 11:34:33 +08:00
Introduce EIGEN_PI, get rid of M_PI and acos(-1.0)
This commit is contained in:
@@ -30,8 +30,8 @@ template<typename QuatType> void check_slerp(const QuatType& q0, const QuatType&
|
||||
Scalar largeEps = test_precision<Scalar>();
|
||||
|
||||
Scalar theta_tot = AA(q1*q0.inverse()).angle();
|
||||
if(theta_tot>M_PI)
|
||||
theta_tot = Scalar(2.*M_PI)-theta_tot;
|
||||
if(theta_tot>EIGEN_PI)
|
||||
theta_tot = Scalar(2.*EIGEN_PI)-theta_tot;
|
||||
for(Scalar t=0; t<=Scalar(1.001); t+=Scalar(0.1))
|
||||
{
|
||||
QuatType q = q0.slerp(t,q1);
|
||||
@@ -64,8 +64,8 @@ template<typename Scalar, int Options> void quaternion(void)
|
||||
v2 = Vector3::Random(),
|
||||
v3 = Vector3::Random();
|
||||
|
||||
Scalar a = internal::random<Scalar>(-Scalar(M_PI), Scalar(M_PI)),
|
||||
b = internal::random<Scalar>(-Scalar(M_PI), Scalar(M_PI));
|
||||
Scalar a = internal::random<Scalar>(-Scalar(EIGEN_PI), Scalar(EIGEN_PI)),
|
||||
b = internal::random<Scalar>(-Scalar(EIGEN_PI), Scalar(EIGEN_PI));
|
||||
|
||||
// Quaternion: Identity(), setIdentity();
|
||||
Quaternionx q1, q2;
|
||||
@@ -82,8 +82,8 @@ template<typename Scalar, int Options> void quaternion(void)
|
||||
|
||||
// angular distance
|
||||
Scalar refangle = abs(AngleAxisx(q1.inverse()*q2).angle());
|
||||
if (refangle>Scalar(M_PI))
|
||||
refangle = Scalar(2)*Scalar(M_PI) - refangle;
|
||||
if (refangle>Scalar(EIGEN_PI))
|
||||
refangle = Scalar(2)*Scalar(EIGEN_PI) - refangle;
|
||||
|
||||
if((q1.coeffs()-q2.coeffs()).norm() > 10*largeEps)
|
||||
{
|
||||
@@ -156,7 +156,7 @@ template<typename Scalar, int Options> void quaternion(void)
|
||||
check_slerp(q1,q2);
|
||||
|
||||
q1 = AngleAxisx(b, v1.normalized());
|
||||
q2 = AngleAxisx(b+Scalar(M_PI), v1.normalized());
|
||||
q2 = AngleAxisx(b+Scalar(EIGEN_PI), v1.normalized());
|
||||
check_slerp(q1,q2);
|
||||
|
||||
q1 = AngleAxisx(b, v1.normalized());
|
||||
@@ -179,7 +179,7 @@ template<typename Scalar> void mapQuaternion(void){
|
||||
|
||||
Vector3 v0 = Vector3::Random(),
|
||||
v1 = Vector3::Random();
|
||||
Scalar a = internal::random<Scalar>(-Scalar(M_PI), Scalar(M_PI));
|
||||
Scalar a = internal::random<Scalar>(-Scalar(EIGEN_PI), Scalar(EIGEN_PI));
|
||||
|
||||
EIGEN_ALIGN_DEFAULT Scalar array1[4];
|
||||
EIGEN_ALIGN_DEFAULT Scalar array2[4];
|
||||
|
||||
Reference in New Issue
Block a user