~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

Linux Cross Reference
Tina4/src/math/matrix/mat_trnsf2.c

Version: ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /**@(#)Matrix to/from Transform2 conversions
  2  */
  3 
  4 #include <tina/sys.h>
  5 #include <tina/math.h>
  6 
  7 double  matrix_getf();
  8 Matrix *matrix_alloc();
  9 
 10 Matrix *matrix_transform2(Transform2 transf)
 11 {
 12     Matrix *mat = matrix_alloc(3, 3, matrix_full, float_v);
 13     float **el;
 14     int     i, j;
 15 
 16     el = mat->el.float_v;
 17     for (i = 0; i < 2; ++i)
 18         for (j = 0; j < 2; ++j)
 19             el[i][j] = transf.R.el[i][j];
 20 
 21     for (i = 0; i < 2; ++i)
 22         el[i][2] = transf.t.el[i];
 23 
 24     el[2][2] = 1.0;
 25 
 26     return (mat);
 27 }
 28 
 29 Transform2 trans2_matrix(Matrix * mat)
 30 {
 31     Transform2 transf = {Transform2_id};
 32     float **el = mat->el.float_v;
 33     int     i, j;
 34 
 35     for (i = 0; i < 2; ++i)
 36         for (j = 0; j < 2; ++j)
 37             transf.R.el[i][j] = el[i][j];
 38 
 39     for (i = 0; i < 2; ++i)
 40         el[i][2] = transf.t.el[i] = el[i][2];
 41 
 42     return (transf);
 43 }
 44 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

This page was automatically generated by the LXR engine.
Visit the LXR main site for more information.