Removed dependecies on UnityEngine
This commit is contained in:
parent
78d0e179df
commit
f1a550e7f3
@ -4,8 +4,8 @@ using Passer.LinearAlgebra;
|
|||||||
#if UNITY_5_3_OR_NEWER
|
#if UNITY_5_3_OR_NEWER
|
||||||
using Vector3Float = UnityEngine.Vector3;
|
using Vector3Float = UnityEngine.Vector3;
|
||||||
using Vector2Float = UnityEngine.Vector2;
|
using Vector2Float = UnityEngine.Vector2;
|
||||||
#endif
|
|
||||||
using Quaternion = UnityEngine.Quaternion;
|
using Quaternion = UnityEngine.Quaternion;
|
||||||
|
#endif
|
||||||
|
|
||||||
public readonly struct Slice {
|
public readonly struct Slice {
|
||||||
public uint start { get; }
|
public uint start { get; }
|
||||||
@ -91,6 +91,7 @@ public class Matrix2 {
|
|||||||
return new Matrix2(result);
|
return new Matrix2(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if UNITY_5_3_OR_NEWER
|
||||||
public Vector3Float GetRow3(int rowIx) {
|
public Vector3Float GetRow3(int rowIx) {
|
||||||
uint cols = this.nCols;
|
uint cols = this.nCols;
|
||||||
Vector3Float row = new() {
|
Vector3Float row = new() {
|
||||||
@ -100,6 +101,7 @@ public class Matrix2 {
|
|||||||
};
|
};
|
||||||
return row;
|
return row;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
public void SetRow(int rowIx, Matrix1 v) {
|
public void SetRow(int rowIx, Matrix1 v) {
|
||||||
for (uint ix = 0; ix < v.size; ix++)
|
for (uint ix = 0; ix < v.size; ix++)
|
||||||
this.data[rowIx, ix] = v.data[ix];
|
this.data[rowIx, ix] = v.data[ix];
|
||||||
@ -430,6 +432,7 @@ public class Matrix1 {
|
|||||||
return new Matrix1(result);
|
return new Matrix1(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if UNITY_5_3_OR_NEWER
|
||||||
public static Matrix1 FromQuaternion(Quaternion q) {
|
public static Matrix1 FromQuaternion(Quaternion q) {
|
||||||
float[] result = new float[4];
|
float[] result = new float[4];
|
||||||
result[0] = q.x;
|
result[0] = q.x;
|
||||||
@ -438,6 +441,7 @@ public class Matrix1 {
|
|||||||
result[3] = q.w;
|
result[3] = q.w;
|
||||||
return new Matrix1(result);
|
return new Matrix1(result);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
public Vector2Float vector2 {
|
public Vector2Float vector2 {
|
||||||
get {
|
get {
|
||||||
@ -453,6 +457,8 @@ public class Matrix1 {
|
|||||||
return new Vector3Float(this.data[0], this.data[1], this.data[2]);
|
return new Vector3Float(this.data[0], this.data[1], this.data[2]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if UNITY_5_3_OR_NEWER
|
||||||
public Quaternion quaternion {
|
public Quaternion quaternion {
|
||||||
get {
|
get {
|
||||||
if (this.size != 4)
|
if (this.size != 4)
|
||||||
@ -460,6 +466,7 @@ public class Matrix1 {
|
|||||||
return new Quaternion(this.data[0], this.data[1], this.data[2], this.data[3]);
|
return new Quaternion(this.data[0], this.data[1], this.data[2], this.data[3]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
public Matrix1 Clone() {
|
public Matrix1 Clone() {
|
||||||
float[] data = new float[this.size];
|
float[] data = new float[this.size];
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
using System;
|
using System;
|
||||||
|
#if UNITY_5_3_OR_NEWER
|
||||||
using Quaternion = UnityEngine.Quaternion;
|
using Quaternion = UnityEngine.Quaternion;
|
||||||
|
#endif
|
||||||
namespace Passer.LinearAlgebra {
|
namespace Passer.LinearAlgebra {
|
||||||
|
|
||||||
public class QuaternionOf<T> {
|
public class QuaternionOf<T> {
|
||||||
@ -15,6 +17,7 @@ namespace Passer.LinearAlgebra {
|
|||||||
this.w = w;
|
this.w = w;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if UNITY_5_3_OR_NEWER
|
||||||
public static Matrix2 ToRotationMatrix(Quaternion q) {
|
public static Matrix2 ToRotationMatrix(Quaternion q) {
|
||||||
float w = q.x, x = q.y, y = q.z, z = q.w;
|
float w = q.x, x = q.y, y = q.z, z = q.w;
|
||||||
|
|
||||||
@ -64,6 +67,7 @@ namespace Passer.LinearAlgebra {
|
|||||||
|
|
||||||
return new Quaternion(x, y, z, w);
|
return new Quaternion(x, y, z, w);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
// public class Quaternion : QuaternionOf<float> {
|
// public class Quaternion : QuaternionOf<float> {
|
||||||
|
@ -3,7 +3,7 @@ using System;
|
|||||||
using System.Threading;
|
using System.Threading;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
|
|
||||||
using Passer.RoboidControl;
|
using RoboidControl;
|
||||||
|
|
||||||
namespace ControlCore.test {
|
namespace ControlCore.test {
|
||||||
public class Tests {
|
public class Tests {
|
||||||
@ -29,7 +29,7 @@ namespace ControlCore.test {
|
|||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void Test_SiteServer() {
|
public void Test_SiteServer() {
|
||||||
SiteServer siteServer = new SiteServer(7681);
|
SiteServer siteServer = new SiteServer(7681);
|
||||||
|
|
||||||
ulong milliseconds = (ulong)DateTimeOffset.UtcNow.ToUnixTimeMilliseconds();
|
ulong milliseconds = (ulong)DateTimeOffset.UtcNow.ToUnixTimeMilliseconds();
|
||||||
ulong startTime = milliseconds;
|
ulong startTime = milliseconds;
|
||||||
@ -63,7 +63,7 @@ namespace ControlCore.test {
|
|||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void Test_ThingMsg() {
|
public void Test_ThingMsg() {
|
||||||
SiteServer siteServer = new SiteServer();
|
SiteServer siteServer = new SiteServer(7681);
|
||||||
Participant participant = new Participant("127.0.0.1");
|
Participant participant = new Participant("127.0.0.1");
|
||||||
Thing thing = new Thing(participant) {
|
Thing thing = new Thing(participant) {
|
||||||
name = "First Thing",
|
name = "First Thing",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user