33 lines
811 B
C#
33 lines
811 B
C#
#if UNITY_5_3_OR_NEWER
|
|
using Passer.LinearAlgebra.Vector3Float = UnityEngine.Vector3
|
|
#else
|
|
|
|
namespace Passer.LinearAlgebra {
|
|
|
|
public class Vector3Of<T> {
|
|
public T x;
|
|
public T y;
|
|
public T z;
|
|
|
|
public Vector3Of(T x, T y, T z) {
|
|
this.x = x;
|
|
this.y = y;
|
|
this.z = z;
|
|
}
|
|
|
|
// public uint magnitude {
|
|
// get => (float)Math.Sqrt(this.x * this.x + this.y * this.y + this.z * this.z);
|
|
// }
|
|
}
|
|
|
|
public class Vector3Int(int x, int y, int z) : Vector3Of<int>(x, y, z) {
|
|
}
|
|
public class Vector3Float(float x, float y, float z) : Vector3Of<float>(x, y, z) {
|
|
|
|
public float magnitude {
|
|
get => (float)Math.Sqrt(this.x * this.x + this.y * this.y + this.z * this.z);
|
|
}
|
|
}
|
|
}
|
|
|
|
#endif |