Advertisement
Guest User

Move.cpp

a guest
Jun 4th, 2014
194
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.65 KB | None | 0 0
  1. #include "composant.hpp"
  2. #include "Move.hpp"
  3. #include <cmath>
  4.  
  5. void Camera::MoveTranslation(Vecteur vec){
  6. m_Xc += vec.getXv();
  7. m_Yc += vec.getYv();
  8. m_Zc += vec.getZv();
  9. }
  10.  
  11. void Camera::MoveRotation(int angle){
  12. int x = direction->getXv();
  13. int y = direction->getXv();
  14. int z = direction->getZv();
  15. double i;
  16.  
  17. i = acos(x/(sqrt(pow(x,2)+ pow(y,2))))+angle;
  18. x = cos(i);
  19. if(x - floor(x)>0,5){
  20. x = ceil(x);
  21. } else{
  22. x = floor(x);
  23. }
  24. y = sin(i);
  25. if(y - floor(y)>0,5){
  26. x = ceil(y);
  27. } else{
  28. x = floor(y);
  29. }
  30.  
  31. direction->SetDirection( x, y, z);
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement