@SmallMatrix3.h 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. /******************************************************************************/
  2. /******************************************************************************/
  3. /*class Matrix3_8 // Matrix3 stored using 8 bytes
  4. {
  5. ushort orn , // orientation (2 bytes total)
  6. size[3]; // size encoded to 16-bit float (6 bytes total)
  7. Vec scale( )C {return Vec(F16To32(size[0]), F16To32(size[1]), F16To32(size[2]));}
  8. void set (Matrix3 &matrix)C {File f; f.readMem(&orn, SIZE(orn)).decOrient2(matrix); matrix.scaleL(scale());}
  9. void zero ( ) {Zero(T);}
  10. bool operator==(C Matrix3_8 &matrix)C {return orn==matrix.orn && size[0]==matrix.size[0] && size[1]==matrix.size[1] && size[2]==matrix.size[2];}
  11. bool operator!=(C Matrix3_8 &matrix)C {return orn!=matrix.orn || size[0]!=matrix.size[0] || size[1]!=matrix.size[1] || size[2]!=matrix.size[2];}
  12. Matrix3_8() {}
  13. Matrix3_8(C Matrix3 &matrix)
  14. {
  15. size[0]=F32To16(Mid(matrix.x.length(), (flt)-HALF_MAX, (flt)HALF_MAX));
  16. size[1]=F32To16(Mid(matrix.y.length(), (flt)-HALF_MAX, (flt)HALF_MAX));
  17. size[2]=F32To16(Mid(matrix.z.length(), (flt)-HALF_MAX, (flt)HALF_MAX));
  18. File f; f.writeMem().cmpOrient2(matrix).pos(0); f>>orn;
  19. }
  20. }*/
  21. class SmallMatrix3 // Matrix3 stored using 2xVec (2*3xFlt, 2*3*4xByte, 24 bytes)
  22. {
  23. Vec angle,
  24. scale;
  25. bool operator==(C SmallMatrix3 &m)C;
  26. bool operator!=(C SmallMatrix3 &m)C;
  27. void set(Matrix3 &matrix)C;
  28. SmallMatrix3();
  29. SmallMatrix3(C Matrix3 &matrix);
  30. };
  31. /******************************************************************************/
  32. /******************************************************************************/
  33. /******************************************************************************/