Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 2nd, 2012  |  syntax: None  |  size: 0.35 KB  |  hits: 15  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. Lag in rotation 2D
  2. $cs=cos($radian);
  3. $sn=sin($radian);
  4.  
  5. $x2=($x*$cs)-($y*$sn);
  6. $y2=($x*$sn)+($y*$cs);
  7.        
  8. $width=2048;
  9. $height=1365;
  10.  
  11. $radian=$rot*M_PI/180;
  12.  
  13. $cs=cos($radian);
  14. $sn=sin($radian);
  15.  
  16. $center_x=$width/2;
  17. $center_y=$height/2;
  18.  
  19. $x-=$center_x;
  20. $y-=$center_y;
  21.  
  22. $x2=($x*$cs)-($y*$sn);
  23. $y2=($x*$sn)+($y*$cs);
  24.  
  25. $x=$x2+$center_x;
  26. $y=$y2+$center_y;