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.

31 lines
931 B

4 years ago
  1. using System.Collections.Generic;
  2. namespace UnityEngine.TestTools.Utils
  3. {
  4. public class QuaternionEqualityComparer : IEqualityComparer<Quaternion>
  5. {
  6. private const float k_DefaultError = 0.00001f;
  7. private readonly float AllowedError;
  8. private static readonly QuaternionEqualityComparer m_Instance = new QuaternionEqualityComparer();
  9. public static QuaternionEqualityComparer Instance { get { return m_Instance; } }
  10. private QuaternionEqualityComparer() : this(k_DefaultError) {}
  11. public QuaternionEqualityComparer(float allowedError)
  12. {
  13. AllowedError = allowedError;
  14. }
  15. public bool Equals(Quaternion expected, Quaternion actual)
  16. {
  17. return Mathf.Abs(Quaternion.Dot(expected, actual)) > (1.0f - AllowedError);
  18. }
  19. public int GetHashCode(Quaternion quaternion)
  20. {
  21. return 0;
  22. }
  23. }
  24. }