diff options
author | Melanie | 2012-01-06 21:37:01 +0100 |
---|---|---|
committer | Melanie | 2012-01-06 21:37:01 +0100 |
commit | de9d6096a5b1ddc8b7dfa57bffb73493b223df59 (patch) | |
tree | ef7147b4fd0958f559ad513e36f25ab3eca96842 /OpenSim/Region/ScriptEngine/Shared/Api | |
parent | Add osNpcCreateOwned to create an owned NPC. Those can be sensed only by the ... (diff) | |
parent | Merge branch 'master' into careminster (diff) | |
download | opensim-SC_OLD-de9d6096a5b1ddc8b7dfa57bffb73493b223df59.zip opensim-SC_OLD-de9d6096a5b1ddc8b7dfa57bffb73493b223df59.tar.gz opensim-SC_OLD-de9d6096a5b1ddc8b7dfa57bffb73493b223df59.tar.bz2 opensim-SC_OLD-de9d6096a5b1ddc8b7dfa57bffb73493b223df59.tar.xz |
Merge branch 'master' of ssh://3dhosting.de/var/git/careminster
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) |