diff options
author | Melanie | 2012-01-06 21:41:36 +0000 |
---|---|---|
committer | Melanie | 2012-01-06 21:41:36 +0000 |
commit | 11c48ac80708051a7d5b32ced81712b5c1be77aa (patch) | |
tree | 3a1e0fdd41b7c8a47072b84037828a9f4db31f27 /OpenSim/Region/ScriptEngine/Shared/Api | |
parent | Replaced llRot2Euler function. (diff) | |
parent | eliminate a few tabs from OpenSimDefaults.ini (diff) | |
download | opensim-SC_OLD-11c48ac80708051a7d5b32ced81712b5c1be77aa.zip opensim-SC_OLD-11c48ac80708051a7d5b32ced81712b5c1be77aa.tar.gz opensim-SC_OLD-11c48ac80708051a7d5b32ced81712b5c1be77aa.tar.bz2 opensim-SC_OLD-11c48ac80708051a7d5b32ced81712b5c1be77aa.tar.xz |
Merge branch 'master' into careminster
Conflicts:
OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiTest.cs
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Shared/Api')
-rw-r--r-- | OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 14 |
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) |