Bug 362 - Multiplication of Affine3f with Projective3f fails
Multiplication of Affine3f with Projective3f fails
Status: RESOLVED FIXED
Product: Eigen
Classification: Unclassified
Component: Geometry
3.0
x86 - 32-bit Windows
: --- critical
Assigned To: Nobody
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2011-10-14 13:33 UTC by mailhack
Modified: 2012-03-30 23:24 UTC (History)
4 users (show)



Attachments

Description mailhack 2011-10-14 13:33:36 UTC
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!!
Comment 1 Gael Guennebaud 2012-03-30 23:24:39 UTC
that's a shame we had such a bug. fixed there:

https://bitbucket.org/eigen/eigen/changeset/2bef1d9d1bee/
changeset:   2bef1d9d1bee
user:        ggael
date:        2012-03-30 23:22:29
summary:     fix bug 362 and add missing specialization for affine-compact * projective

https://bitbucket.org/eigen/eigen/changeset/e3df03351a72/
changeset:   e3df03351a72
branch:      3.0
user:        ggael
date:        2012-03-30 23:22:29
summary:     fix bug 362 and add missing specialization for affine-compact * projective
(transplanted from 2bef1d9d1bee20fca29ebe715d8a838dd5c10990)

Note You need to log in before you can comment on or make changes to this bug.