Compare commits
No commits in common. "83159b487d34c3ff918bc85df52fbc51129b251e" and "67cf8b31fb9c6d4ec4c053da39ea1162f0e066f8" have entirely different histories.
83159b487d
...
67cf8b31fb
@ -1,7 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
#if UNITY_5_3_OR_NEWER
|
#if UNITY_5_3_OR_NEWER
|
||||||
//using Vector3Float = UnityEngine.Vector3;
|
using Vector3Float = UnityEngine.Vector3;
|
||||||
using Vector3 = UnityEngine.Vector3;
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
namespace LinearAlgebra {
|
namespace LinearAlgebra {
|
||||||
@ -67,16 +66,16 @@ namespace LinearAlgebra {
|
|||||||
public readonly static Spherical forward = new(1, Direction.forward);
|
public readonly static Spherical forward = new(1, Direction.forward);
|
||||||
|
|
||||||
|
|
||||||
// public static Spherical FromVector3Float(Vector3Float v) {
|
public static Spherical FromVector3Float(Vector3Float v) {
|
||||||
// float distance = v.magnitude;
|
float distance = v.magnitude;
|
||||||
// if (distance == 0.0f)
|
if (distance == 0.0f)
|
||||||
// return Spherical.zero;
|
return Spherical.zero;
|
||||||
// else {
|
else {
|
||||||
// float verticalAngle = (float)((Angle.pi / 2 - Math.Acos(v.y / distance)) * Angle.Rad2Deg);
|
float verticalAngle = (float)((Angle.pi / 2 - Math.Acos(v.y / distance)) * Angle.Rad2Deg);
|
||||||
// float horizontalAngle = (float)Math.Atan2(v.x, v.z) * Angle.Rad2Deg;
|
float horizontalAngle = (float)Math.Atan2(v.x, v.z) * Angle.Rad2Deg;
|
||||||
// return Spherical.Degrees(distance, horizontalAngle, verticalAngle);
|
return Spherical.Degrees(distance, horizontalAngle, verticalAngle);
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
|
|
||||||
public static Spherical FromVector3(Vector3 v) {
|
public static Spherical FromVector3(Vector3 v) {
|
||||||
float distance = v.magnitude;
|
float distance = v.magnitude;
|
||||||
@ -89,21 +88,21 @@ namespace LinearAlgebra {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// public Vector3Float ToVector3Float() {
|
public Vector3Float ToVector3Float() {
|
||||||
// float verticalRad = (Angle.pi / 2) - this.direction.vertical * Angle.Deg2Rad;
|
float verticalRad = (Angle.pi / 2) - this.direction.vertical * Angle.Deg2Rad;
|
||||||
// float horizontalRad = this.direction.horizontal * Angle.Deg2Rad;
|
float horizontalRad = this.direction.horizontal * Angle.Deg2Rad;
|
||||||
// float cosVertical = (float)Math.Cos(verticalRad);
|
float cosVertical = (float)Math.Cos(verticalRad);
|
||||||
// float sinVertical = (float)Math.Sin(verticalRad);
|
float sinVertical = (float)Math.Sin(verticalRad);
|
||||||
// float cosHorizontal = (float)Math.Cos(horizontalRad);
|
float cosHorizontal = (float)Math.Cos(horizontalRad);
|
||||||
// float sinHorizontal = (float)Math.Sin(horizontalRad);
|
float sinHorizontal = (float)Math.Sin(horizontalRad);
|
||||||
|
|
||||||
// float x = this.distance * sinVertical * sinHorizontal;
|
float x = this.distance * sinVertical * sinHorizontal;
|
||||||
// float y = this.distance * cosVertical;
|
float y = this.distance * cosVertical;
|
||||||
// float z = this.distance * sinVertical * cosHorizontal;
|
float z = this.distance * sinVertical * cosHorizontal;
|
||||||
|
|
||||||
// Vector3Float v = new(x, y, z);
|
Vector3Float v = new(x, y, z);
|
||||||
// return v;
|
return v;
|
||||||
// }
|
}
|
||||||
|
|
||||||
public Vector3 ToVector3() {
|
public Vector3 ToVector3() {
|
||||||
float verticalRad = (Angle.pi / 2) - this.direction.vertical * Angle.Deg2Rad;
|
float verticalRad = (Angle.pi / 2) - this.direction.vertical * Angle.Deg2Rad;
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
#if !UNITY_5_6_OR_NEWER
|
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
|
|
||||||
namespace LinearAlgebra.Test {
|
namespace LinearAlgebra.Test {
|
||||||
@ -26,5 +25,4 @@ namespace LinearAlgebra.Test {
|
|||||||
Assert.AreEqual(v1.distance, r.distance, "Addition(0,0,0)");
|
Assert.AreEqual(v1.distance, r.distance, "Addition(0,0,0)");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
|
@ -24,7 +24,7 @@ namespace RoboidControl {
|
|||||||
//thisParticipant = participant;
|
//thisParticipant = participant;
|
||||||
}
|
}
|
||||||
|
|
||||||
public TouchSensor(Thing parent, bool invokeEvent = true) : base(parent, (byte)Type.TouchSensor, invokeEvent) { }
|
public TouchSensor(Thing parent) : base(parent) { }
|
||||||
|
|
||||||
public ParticipantUDP thisParticipant;
|
public ParticipantUDP thisParticipant;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user