source: proiecte/pmake3d/make3d_original/Make3dSingleImageStanford_version0.1/third_party/vrippack-0.31/src/pvrip/matrix2quat.cc @ 37

Last change on this file since 37 was 37, checked in by (none), 14 years ago

Added original make3d

File size: 783 bytes
Line 
1// matrix2quat.C by Sean Eron Anderson, 1998
2// Compile with: CC matrix2quat.C -o matrix2quat -lInventor
3
4#include <Inventor/SbLinear.h>
5#include <iostream.h>
6
7int
8main()
9{
10     SbMatrix mat;
11     for (int i = 0; i < 4; i++)
12     {
13          for (int j = 0; j < 4; j++)
14          {
15               cin >> mat[i][j];
16          }
17     }
18     if (!cin)
19     {
20          cerr << "Error: premature end of input.\n"
21               << "Input: 4x4 matrix; output: tx ty tz qi qj qk ql\n";
22          return 1;
23     }
24     
25     mat = mat.transpose();
26     
27     SbVec3f t, s;
28     SbRotation r, so;
29     mat.getTransform(t, r, s, so);
30     
31     cout << t[0] << " " << t[1] << " " << t[2] << " ";
32     cout << -r.getValue()[0] << " " << -r.getValue()[1] << " "
33          << -r.getValue()[2] << " " << r.getValue()[3] << endl;
34     
35     return 0;
36}
Note: See TracBrowser for help on using the repository browser.