transform.c 481 B

123456789101112131415161718192021
  1. /*
  2. * ALGO : PROJ. : Volume
  3. * RESEARCH : File : transform.c
  4. * : Date : 20100531.0725UTC
  5. * : Email : mail@algoresearch.net
  6. */
  7. #include "transform.h"
  8. void rotate_xy(VERTEX *in, VERTEX *out, float ax, float ay, VERTEX *offset)
  9. {
  10. float x = in->x - offset->x,
  11. y = in->y - offset->y,
  12. z = in->z - offset->z,
  13. Cax = cos(ax),
  14. Sax = sin(ax);
  15. out->y = y * Cax - z * Sax;
  16. out->z = y * Sax + z * Cax;
  17. out->x = out->z * sin(ay) + x * cos(ay);
  18. }