From 7a67b726d5be8b7eb7d04eabdb98dc4e3beb9d71 Mon Sep 17 00:00:00 2001 From: dahlia Date: Mon, 7 Sep 2009 17:12:17 -0700 Subject: [PATCH] random drive-by maths optimization in llRot2Euler() and llEuler2Rot() --- .../Shared/Api/Implementation/LSL_Api.cs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 16dd8341c5..077315e0df 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -497,9 +497,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api NormalizeAngle(Math.Atan2(n, Math.Sqrt(p))), NormalizeAngle(Math.Atan2(2.0 * (r.z * r.s - r.x * r.y), (t.x - t.y - t.z + t.s)))); else if (n > 0) - return new LSL_Vector(0.0, Math.PI / 2, NormalizeAngle(Math.Atan2((r.z * r.s + r.x * r.y), 0.5 - t.x - t.z))); + return new LSL_Vector(0.0, Math.PI * 0.5, NormalizeAngle(Math.Atan2((r.z * r.s + r.x * r.y), 0.5 - t.x - t.z))); else - return new LSL_Vector(0.0, -Math.PI / 2, NormalizeAngle(Math.Atan2((r.z * r.s + r.x * r.y), 0.5 - t.x - t.z))); + return new LSL_Vector(0.0, -Math.PI * 0.5, NormalizeAngle(Math.Atan2((r.z * r.s + r.x * r.y), 0.5 - t.x - t.z))); } /* From wiki: @@ -553,12 +553,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api double x,y,z,s; - double c1 = Math.Cos(v.x/2.0); - double c2 = Math.Cos(v.y/2.0); - double c3 = Math.Cos(v.z/2.0); - double s1 = Math.Sin(v.x/2.0); - double s2 = Math.Sin(v.y/2.0); - double s3 = Math.Sin(v.z/2.0); + double c1 = Math.Cos(v.x * 0.5); + double c2 = Math.Cos(v.y * 0.5); + double c3 = Math.Cos(v.z * 0.5); + double s1 = Math.Sin(v.x * 0.5); + double s2 = Math.Sin(v.y * 0.5); + double s3 = Math.Sin(v.z * 0.5); x = s1*c2*c3+c1*s2*s3; y = c1*s2*c3-s1*c2*s3;