SW 중심대학 OSS GIT 서버 박건태, 이승준, 고기완, 이준호 새로운 배포
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

50 lines
1.2 KiB

4 years ago
  1. using UnityEngine;
  2. namespace ARLocation
  3. {
  4. public static class MathUtils
  5. {
  6. public static Vector2 HorizontalVector(Vector3 v)
  7. {
  8. return new Vector2(v.x, v.z);
  9. }
  10. public static Vector3 HorizontalVectorToVector3(Vector2 v, float y = 0.0f)
  11. {
  12. return new Vector3(v.x, y, v.y);
  13. }
  14. public static float HorizontalDistance(Vector3 a, Vector3 b)
  15. {
  16. return Vector2.Distance(HorizontalVector(a), HorizontalVector(b));
  17. }
  18. public static Vector3 SetY(Vector3 v, float y)
  19. {
  20. return new Vector3(v.x, y, v.z);
  21. }
  22. public static float DegreesToRadians(float degrees)
  23. {
  24. return Mathf.PI * degrees / 180.0f;
  25. }
  26. public static float RadiansToDegrees(float degrees)
  27. {
  28. return 180.0f * degrees / Mathf.PI;
  29. }
  30. public static class Double
  31. {
  32. public static double DegreesToRadians(double degrees)
  33. {
  34. return System.Math.PI * degrees / 180.0;
  35. }
  36. public static double RadiansToDegrees(double degrees)
  37. {
  38. return 180.0 * degrees / System.Math.PI;
  39. }
  40. }
  41. }
  42. }