[go: up one dir, main page]

Multiplication of Affine3f with Projective3f fails

Submitted by mai..@..mx.net

Assigned to Nobody

Link to original bugzilla bug (#362)
Version: 3.0
Operating system: Windows

Description

Hi,

I discovered a weird error, summarized by the code snippet below.
In my opinion, res1 and res2 should match, but they don't.
The error occurs only with an Affine3f on the left of the multiplication and a Projective3f on the right. By the way, the result res2 which is computed as the pure matrix product is correct. Either I get something really wrong here, or maybe there is a bug in the simplifications that Eigen performs for the multiplication of Affine3f*Projective3f.

Program:

Eigen::Projective3f Proj;  
Proj.matrix() <<  
      1.54235,         0,         0,         0,  
            0,   1.54235,         0,         0,  
            0,         0,   -1.0004, -0.020004,  
            0,         0,        -1,         0;  

Eigen::Affine3f V;  
V.matrix() <<  
     50,   0,   0,  50,  
      0,  50,   0,  50,  
      0,   0, 0.5, 0.5,  
      0,   0,   0,   1;  

Matrix4f res1 = (V*Proj).matrix();  
Matrix4f res2 = V.matrix() * Proj.matrix();  

std::cout << "res1 = " << std::endl << res1.matrix() << std::endl;  
std::cout << "res2 = " << std::endl << res2.matrix() << std::endl;   

Output:

res1 =
77.1175 0 0 50
0 77.1175 0 50
0 0 -0.5002 0.489998
0 0 0 1
res2 =
77.1175 0 -50 0
0 77.1175 -50 0
0 0 -1.0002 -0.010002
0 0 -1 0

Thanks!!

Edited by Eigen Bugzilla