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