mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-07-09 06:31:47 +08:00
Relaxed umeyama test. Problem was ill-posed if linear part was scaled with very small number. This should fix bug #744.
(transplanted from b14a4628aff4b92761229c862a331342a2bb518b )
This commit is contained in:
parent
2ad3dac422
commit
53726663c7
@ -130,10 +130,11 @@ void run_fixed_size_test(int num_elements)
|
|||||||
|
|
||||||
// MUST be positive because in any other case det(cR_t) may become negative for
|
// MUST be positive because in any other case det(cR_t) may become negative for
|
||||||
// odd dimensions!
|
// odd dimensions!
|
||||||
const Scalar c = abs(internal::random<Scalar>());
|
// Also if c is to small compared to t.norm(), problem is ill-posed (cf. Bug 744)
|
||||||
|
const Scalar c = internal::random<Scalar>(0.5, 2.0);
|
||||||
|
|
||||||
FixedMatrix R = randMatrixSpecialUnitary<Scalar>(dim);
|
FixedMatrix R = randMatrixSpecialUnitary<Scalar>(dim);
|
||||||
FixedVector t = Scalar(50)*FixedVector::Random(dim,1);
|
FixedVector t = Scalar(32)*FixedVector::Random(dim,1);
|
||||||
|
|
||||||
HomMatrix cR_t = HomMatrix::Identity(dim+1,dim+1);
|
HomMatrix cR_t = HomMatrix::Identity(dim+1,dim+1);
|
||||||
cR_t.block(0,0,dim,dim) = c*R;
|
cR_t.block(0,0,dim,dim) = c*R;
|
||||||
@ -149,9 +150,9 @@ void run_fixed_size_test(int num_elements)
|
|||||||
|
|
||||||
HomMatrix cR_t_umeyama = umeyama(src_block, dst_block);
|
HomMatrix cR_t_umeyama = umeyama(src_block, dst_block);
|
||||||
|
|
||||||
const Scalar error = ( cR_t_umeyama*src - dst ).array().square().sum();
|
const Scalar error = ( cR_t_umeyama*src - dst ).squaredNorm();
|
||||||
|
|
||||||
VERIFY(error < Scalar(10)*std::numeric_limits<Scalar>::epsilon());
|
VERIFY(error < Scalar(16)*std::numeric_limits<Scalar>::epsilon());
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_umeyama()
|
void test_umeyama()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user