[ create a new paste ] login | about

Link: http://codepad.org/hyQD4BaE    [ raw code | fork ]

C++, pasted on Dec 6:
 void Rotate( float ax, float ay, float az ) {
  static Vertex temp;
  ax=deg2rad(ax);
  ay=deg2rad(ay);
  az=deg2rad(az);     
  // Rotate by ax around X axis
  temp.Set(
   x,
   y*cos(ax) - z*sin(ax),
   y*sin(ax) + z*cos(ax)
  );
  Set(&temp);
  // Rotate by ay around Y axis
  temp.Set(
   z*sin(ay) + x*cos(ay),
   y,
   z*cos(ay) - x*sin(ay)
  );
  Set(&temp);
  // Rotate by az around Z axis
  temp.Set(
   x*cos(az) - y*sin(az),
   x*sin(az) + y*cos(az),
   z
  );
  Set(&temp);
 }


Create a new paste based on this one


Comments: