forked from izrik/FbxSharp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFbxVector3.cs
83 lines (74 loc) · 1.96 KB
/
FbxVector3.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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
using System;
namespace FbxSharp
{
public struct FbxVector3
{
public static readonly FbxVector3 Zero = new FbxVector3(0, 0, 0);
public static readonly FbxVector3 One = new FbxVector3(1, 1, 1);
public FbxVector3(FbxVector3 pValue)
{
X = pValue.X;
Y = pValue.Y;
Z = pValue.Z;
}
public FbxVector3(double pX, double pY, double pZ)
{
X = pX;
Y = pY;
Z = pZ;
}
public readonly double X;
public readonly double Y;
public readonly double Z;
public override string ToString()
{
return string.Format("{{X:{0} Y:{1} Z:{2}}}", X, Y, Z);
}
public double this [ int pIndex ]
{
get
{
switch (pIndex)
{
case 0: return X;
case 1: return Y;
case 2: return Z;
default: throw new IndexOutOfRangeException();
}
}
}
public static bool operator ==(FbxVector3 u, FbxVector3 v)
{
return u.Equals(v);
}
public static bool operator !=(FbxVector3 u, FbxVector3 v)
{
return !u.Equals(v);
}
public bool Equals(FbxVector3 other)
{
return (this.X == other.X &&
this.Y == other.Y &&
this.Z == other.Z);
}
public override bool Equals(object obj)
{
if (obj is FbxVector3)
{
return Equals((FbxVector3)obj);
}
else
{
return false;
}
}
public override int GetHashCode()
{
return X.GetHashCode() ^ Y.GetHashCode() ^ Z.GetHashCode();
}
public FbxVector4 ToVector4(double w=0)
{
return new FbxVector4(X, Y, Z, w);
}
}
}