mirror of
https://gitlab.com/libeigen/eigen.git
synced 2026-04-10 11:34:33 +08:00
if EIGEN_NICE_RANDOM is defined, the random functions will return numbers with
few bits left of the comma and for floating-point types will never return zero. This replaces the custom functions in test/main.h, so one does not anymore need to think about that when writing tests.
This commit is contained in:
@@ -49,10 +49,10 @@ template<typename Scalar> void geometry(void)
|
||||
typedef Translation<Scalar,3> Translation3;
|
||||
|
||||
Quaternion q1, q2;
|
||||
Vector3 v0 = test_random_matrix<Vector3>(),
|
||||
v1 = test_random_matrix<Vector3>(),
|
||||
v2 = test_random_matrix<Vector3>();
|
||||
Vector2 u0 = test_random_matrix<Vector2>();
|
||||
Vector3 v0 = Vector3::Random(),
|
||||
v1 = Vector3::Random(),
|
||||
v2 = Vector3::Random();
|
||||
Vector2 u0 = Vector2::Random();
|
||||
Matrix3 matrot1;
|
||||
|
||||
Scalar a = ei_random<Scalar>(-M_PI, M_PI);
|
||||
@@ -134,7 +134,7 @@ template<typename Scalar> void geometry(void)
|
||||
t1.setIdentity();
|
||||
t1.linear() = q1.toRotationMatrix();
|
||||
|
||||
v0 << 50, 2, 1;//= test_random_matrix<Vector3>().cwiseProduct(Vector3(10,2,0.5));
|
||||
v0 << 50, 2, 1;//= ei_random_matrix<Vector3>().cwiseProduct(Vector3(10,2,0.5));
|
||||
t0.scale(v0);
|
||||
t1.prescale(v0);
|
||||
|
||||
@@ -169,8 +169,8 @@ template<typename Scalar> void geometry(void)
|
||||
|
||||
// 2D transformation
|
||||
Transform2 t20, t21;
|
||||
Vector2 v20 = test_random_matrix<Vector2>();
|
||||
Vector2 v21 = test_random_matrix<Vector2>();
|
||||
Vector2 v20 = Vector2::Random();
|
||||
Vector2 v21 = Vector2::Random();
|
||||
for (int k=0; k<2; ++k)
|
||||
if (ei_abs(v21[k])<1e-3) v21[k] = 1e-3;
|
||||
t21.setIdentity();
|
||||
|
||||
Reference in New Issue
Block a user