dmitrysenkovich

Untitled

Aug 29th, 2014
256
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Index: OSGMath.h
  2. ===================================================================
  3. --- OSGMath.h   (revision 91664)
  4. +++ OSGMath.h   (working copy)
  5. @@ -70,6 +70,20 @@
  6.     return a.x() * b.y() - b.x() * a.y();
  7.  }
  8.  
  9. +/**
  10. + * wrapAngle - Приводит значение угла к соответствующему значению из полуинтервала [0, 2*Pi)
  11. + */
  12. +inline double wrapAngle(double& angle)
  13. +{
  14. +   if ((angle >= 0) && (angle < 2*M_PI))
  15. +       return angle;
  16. +
  17. +   else if (angle > 0)
  18. +       return wrapAngle(angle -= 2*M_PI);
  19. +   else
  20. +       return wrapAngle(angle += 2*M_PI);
  21.  }
  22.  
  23. +}
  24. +
  25.  #endif
  26. \ No newline at end of file
Advertisement
Add Comment
Please, Sign In to add comment