[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Openexr-devel] extractScaling from matrices doesn't work with negative
From: |
Benoit Leveau |
Subject: |
[Openexr-devel] extractScaling from matrices doesn't work with negative scales? |
Date: |
Wed, 10 Nov 2010 15:27:03 +0000 |
User-agent: |
Thunderbird 2.0.0.12 (X11/20080213) |
Hi,
I'm probably doing something wrong, but it looks like if you have a negative
scaling in your matrix the extractScaling function (and other functions like
removeScaling that use it)
doesn't work properly.
I just tried the following very simple example, and got the same incorrect
result using OpenEXR 1.4 or 1.7.
Thanks for your help,
Benoit
----------------
#include <OpenEXR/ImathMatrixAlgo.h>
#include <iostream>
int main(int argc, char **argv)
{
Imath::M44f m;
Imath::V3f vec;
for (int i=0;i<4;++i)
for (int j=0;j<4;++j)
{
m.x[i][j] = 0;
}
m.x[3][3] = 1;
m.x[0][0] = 1; m.x[1][1] = 2; m.x[2][2] = 3;
std::cout <<"matrix = " << std::endl << m << std::endl;
if (extractScaling(m,vec,true))
std::cout <<"extracted scaling:" <<std::endl << vec <<
std::endl;
m.x[0][0] = -1; m.x[1][1] = 2; m.x[2][2] = 3;
std::cout <<"matrix = " << std::endl << m << std::endl;
if (extractScaling(m,vec,true))
std::cout <<"extracted scaling:" <<std::endl << vec <<
std::endl;
return 0;
}
----------------
Output:
-------
matrix =
( 1.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
0.000000e+00 2.000000e+00 0.000000e+00 0.000000e+00
0.000000e+00 0.000000e+00 3.000000e+00 0.000000e+00
0.000000e+00 0.000000e+00 0.000000e+00 1.000000e+00)
extracted scaling:
(1 2 3)
matrix =
( -1.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
0.000000e+00 2.000000e+00 0.000000e+00 0.000000e+00
0.000000e+00 0.000000e+00 3.000000e+00 0.000000e+00
0.000000e+00 0.000000e+00 0.000000e+00 1.000000e+00)
extracted scaling:
(-1 -2 -3)
- [Openexr-devel] extractScaling from matrices doesn't work with negative scales?,
Benoit Leveau <=