From ff68c99ab3361bb0165b00ec363d7174cb2a2319 Mon Sep 17 00:00:00 2001 From: Eric Oden Date: Thu, 14 Nov 2013 16:35:42 -0600 Subject: [PATCH 1/2] Fix #232 --- Vector.cs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Vector.cs b/Vector.cs index e57b956..f9e2dbe 100644 --- a/Vector.cs +++ b/Vector.cs @@ -103,6 +103,9 @@ public static explicit operator Direction(Vector d) public static Vector operator *(Vector a, Vector b) { return new Vector(a.x * b.x, a.y * b.y, a.z * b.z); } public static Vector operator *(Vector a, float b) { return new Vector(a.x * b, a.y * b, a.z * b); } public static Vector operator *(Vector a, double b) { return new Vector(a.x * b, a.y * b, a.z * b); } + public static Vector operator /(Vector a, Vector b) { return new Vector(a.x / b.x, a.y / b.y, a.z / b.z); } + public static Vector operator /(Vector a, float b) { return new Vector(a.x / b, a.y / b, a.z / b); } + public static Vector operator /(Vector a, double b) { return new Vector(a.x / b, a.y / b, a.z / b); } public static Vector operator +(Vector a, Vector b) { return new Vector(a.ToVector3D() + b.ToVector3D()); } public static Vector operator -(Vector a, Vector b) { return new Vector(a.ToVector3D() - b.ToVector3D()); } @@ -117,6 +120,11 @@ public override object TryOperation(string op, object other, bool reverseOrder) if (other is Vector) return this * (Vector)other; if (other is double) return this * (double)other; } + else if (op == "/") + { + if (other is Vector) return this / (Vector)other; + if (other is double) return this / (double)other; + } else if (op == "-") { if (!reverseOrder) From b8885734404f666e50d102dd1b7cbcb4b9fdb215 Mon Sep 17 00:00:00 2001 From: Eric Oden Date: Thu, 14 Nov 2013 17:02:34 -0600 Subject: [PATCH 2/2] Fix #235 --- Expression.cs | 2 +- ExpressionTerm.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Expression.cs b/Expression.cs index dff3f7a..8e0ca41 100644 --- a/Expression.cs +++ b/Expression.cs @@ -438,7 +438,7 @@ private SpecialValue TryCreateSV(String name, Term[] p) double[] dp = GetParamsAsT(p, pCount); var q = UnityEngine.Quaternion.LookRotation(VesselUtils.GetNorthVector(executionContext.Vessel), executionContext.Vessel.upAxis); - q *= UnityEngine.Quaternion.Euler(new UnityEngine.Vector3((float)-dp[0], (float)dp[1], (float)(dp.Count() > 2 ? dp[2] : 0))); + q *= UnityEngine.Quaternion.Euler(new UnityEngine.Vector3((float)-dp[1], (float)dp[0], (float)(dp.Count() > 2 ? dp[2] : 0))); return new Direction(q); } diff --git a/ExpressionTerm.cs b/ExpressionTerm.cs index 3e0f52f..389d30c 100644 --- a/ExpressionTerm.cs +++ b/ExpressionTerm.cs @@ -124,7 +124,7 @@ private void processSymbols() if (String.IsNullOrEmpty(Text)) return; // HEADING.. BY is now deprecated in favor of HEADING(x,y), but here it is if you're using it still - Text = Regex.Replace(Text, "HEADING ([ :@A-Za-z0-9\\.\\-\\+\\*/]+) BY ([ :@A-Za-z0-9\\.\\-\\+\\*/]+)", "HEADING($2,$1)", RegexOptions.IgnoreCase); + Text = Regex.Replace(Text, "HEADING ([ :@A-Za-z0-9\\.\\-\\+\\*/]+) BY ([ :@A-Za-z0-9\\.\\-\\+\\*/]+)", "HEADING($1,$2)", RegexOptions.IgnoreCase); // Resource tags are now deprecated in favor of SHIP:ResourceName Text = Regex.Replace(Text, "(\\s|^)<([a-zA-Z]+)>(\\s|$)", " SHIP:$2 ", RegexOptions.IgnoreCase);