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