forked from izrik/FbxSharp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
FbxVector2.cs
57 lines (48 loc) · 1.24 KB
/
FbxVector2.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
using System;
namespace FbxSharp
{
public struct FbxVector2
{
public FbxVector2(double pX, double pY)
{
X = pX;
Y = pY;
}
public FbxVector2(double[] pValue)
{
X = pValue[0];
Y = pValue[1];
}
public readonly double X;
public readonly double Y;
public override string ToString()
{
return string.Format("{{X:{0} Y:{1}}}", X, Y);
}
/// <summary>
/// Two FbxVector4s are equal iff all coordinates (X, Y, Z) are equal.
/// </summary>
/// <param name="other"></param>
/// <returns></returns>
public bool Equals(FbxVector2 other)
{
return this.X.Equals(other.X) && this.Y.Equals(other.Y);
}
/// <summary>
/// Two FbxVector2s are equals iff both coordinates (X, Y) are equal.
/// </summary>
/// <param name="obj"></param>
/// <returns></returns>
public override bool Equals(object obj)
{
if (ReferenceEquals(null, obj)) return false;
return obj is FbxVector2 && this.Equals((FbxVector2) obj);
}
public override int GetHashCode()
{
unchecked {
return (this.X.GetHashCode()*397) ^ this.Y.GetHashCode();
}
}
}
}