| 1 |
/************************************************************************ |
| 2 |
* |
| 3 |
* void SbMatrix::getTransform(SbVec3f &, SbRotation &, SbVec3f &, |
| 4 |
* SbRotation &) const |
| 5 |
* |
| 6 |
************************************************************************/ |
| 7 |
|
| 8 |
#include <stdio.h> |
| 9 |
#include <Inventor/SoDB.h> |
| 10 |
#include <Inventor/SbLinear.h> |
| 11 |
|
| 12 |
|
| 13 |
int |
| 14 |
main(int argc, char ** argv) |
| 15 |
{ |
| 16 |
SoDB::init(); |
| 17 |
|
| 18 |
// FIXME: istty(stdin). 20010114 mortene. |
| 19 |
|
| 20 |
int valsread; |
| 21 |
do { |
| 22 |
SbMat m; |
| 23 |
valsread = fscanf(stdin, |
| 24 |
"%f %f %f %f " |
| 25 |
"%f %f %f %f " |
| 26 |
"%f %f %f %f " |
| 27 |
"%f %f %f %f\n", |
| 28 |
&m[0][0], &m[0][1], &m[0][2], &m[0][3], |
| 29 |
&m[1][0], &m[1][1], &m[1][2], &m[1][3], |
| 30 |
&m[2][0], &m[2][1], &m[2][2], &m[2][3], |
| 31 |
&m[3][0], &m[3][1], &m[3][2], &m[3][3]); |
| 32 |
|
| 33 |
if (valsread == 16) { |
| 34 |
SbMatrix matrix(m); |
| 35 |
SbVec3f trans; |
| 36 |
SbRotation rot; |
| 37 |
SbVec3f scale; |
| 38 |
SbRotation so; |
| 39 |
matrix.getTransform(trans, rot, scale, so); |
| 40 |
|
| 41 |
(void)fprintf(stdout, "%.3f %.3f %.3f\n", trans[0], trans[1], trans[2]); |
| 42 |
const float * a = rot.getValue(); |
| 43 |
(void)fprintf(stdout, "%.3f %.3f %.3f %3f\n", a[0], a[1], a[2], a[3]); |
| 44 |
(void)fprintf(stdout, "%.3f %.3f %.3f\n", scale[0], scale[1], scale[2]); |
| 45 |
a = so.getValue(); |
| 46 |
(void)fprintf(stdout, "%.3f %.3f %.3f %3f\n", a[0], a[1], a[2], a[3]); |
| 47 |
(void)fprintf(stdout, "\n"); |
| 48 |
|
| 49 |
} |
| 50 |
} while (valsread == 16); |
| 51 |
|
| 52 |
if (valsread != EOF) { |
| 53 |
(void)fflush(stdout); |
| 54 |
(void)fprintf(stderr, "Input data format error!\n"); |
| 55 |
} |
| 56 |
|
| 57 |
return 0; |
| 58 |
} |