aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs')
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs14
1 files changed, 9 insertions, 5 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index 3bc8750..466e540 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -5096,15 +5096,19 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
5096 return (double)Math.Asin(val); 5096 return (double)Math.Asin(val);
5097 } 5097 }
5098 5098
5099 // Xantor 30/apr/2008 5099 // jcochran 5/jan/2012
5100 public LSL_Float llAngleBetween(LSL_Rotation a, LSL_Rotation b) 5100 public LSL_Float llAngleBetween(LSL_Rotation a, LSL_Rotation b)
5101 { 5101 {
5102 m_host.AddScriptLPS(1); 5102 m_host.AddScriptLPS(1);
5103 5103
5104 double angle = Math.Acos(a.x * b.x + a.y * b.y + a.z * b.z + a.s * b.s) * 2; 5104 double aa = (a.x * a.x + a.y * a.y + a.z * a.z + a.s * a.s);
5105 if (angle < 0) angle = -angle; 5105 double bb = (b.x * b.x + b.y * b.y + b.z * b.z + b.s * b.s);
5106 if (angle > Math.PI) return (Math.PI * 2 - angle); 5106 double aa_bb = aa * bb;
5107 return angle; 5107 if (aa_bb == 0) return 0.0;
5108 double ab = (a.x * b.x + a.y * b.y + a.z * b.z + a.s * b.s);
5109 double quotient = (ab * ab) / aa_bb;
5110 if (quotient >= 1.0) return 0.0;
5111 return Math.Acos(2 * quotient - 1);
5108 } 5112 }
5109 5113
5110 public LSL_String llGetInventoryKey(string name) 5114 public LSL_String llGetInventoryKey(string name)