Vector4.cs 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. using RootSystem = System;
  2. using System.Linq;
  3. using System.Collections.Generic;
  4. namespace Windows.Kinect
  5. {
  6. //
  7. // Windows.Kinect.Vector4
  8. //
  9. [RootSystem.Runtime.InteropServices.StructLayout(RootSystem.Runtime.InteropServices.LayoutKind.Sequential)]
  10. public struct Vector4
  11. {
  12. public float X { get; set; }
  13. public float Y { get; set; }
  14. public float Z { get; set; }
  15. public float W { get; set; }
  16. public override int GetHashCode()
  17. {
  18. return X.GetHashCode() ^ Y.GetHashCode() ^ Z.GetHashCode() ^ W.GetHashCode();
  19. }
  20. public override bool Equals(object obj)
  21. {
  22. if (!(obj is Vector4))
  23. {
  24. return false;
  25. }
  26. return this.Equals((Vector4)obj);
  27. }
  28. public bool Equals(Vector4 obj)
  29. {
  30. return X.Equals(obj.X) && Y.Equals(obj.Y) && Z.Equals(obj.Z) && W.Equals(obj.W);
  31. }
  32. public static bool operator ==(Vector4 a, Vector4 b)
  33. {
  34. return a.Equals(b);
  35. }
  36. public static bool operator !=(Vector4 a, Vector4 b)
  37. {
  38. return !(a.Equals(b));
  39. }
  40. }
  41. }