diff options
author | Adam Frisby | 2008-05-01 12:11:34 +0000 |
---|---|---|
committer | Adam Frisby | 2008-05-01 12:11:34 +0000 |
commit | 7bcdec4e8f433d0664518a7b9050f3cc1da1db20 (patch) | |
tree | 3d0c0e0b8700e8e923c354f8d8f8cea2df53d143 /OpenSim/Region/ScriptEngine | |
parent | * Insert temporary cast exception catching code to deal with mantis 1099 - my... (diff) | |
download | opensim-SC_OLD-7bcdec4e8f433d0664518a7b9050f3cc1da1db20.zip opensim-SC_OLD-7bcdec4e8f433d0664518a7b9050f3cc1da1db20.tar.gz opensim-SC_OLD-7bcdec4e8f433d0664518a7b9050f3cc1da1db20.tar.bz2 opensim-SC_OLD-7bcdec4e8f433d0664518a7b9050f3cc1da1db20.tar.xz |
* Applying Mantis#1097 - Thanks Xantor!
- Fix for llRound (now rounds in LL-compatible fashion, rather than using bankers rounding)
- Implementation of llAngleBetween
Diffstat (limited to 'OpenSim/Region/ScriptEngine')
-rw-r--r-- | OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs b/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs index a3dcc6d..0773253 100644 --- a/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs +++ b/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs | |||
@@ -258,10 +258,11 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
258 | return (int)Math.Ceiling(f); | 258 | return (int)Math.Ceiling(f); |
259 | } | 259 | } |
260 | 260 | ||
261 | // Xantor 01/May/2008 fixed midpointrounding (2.5 becomes 3.0 instead of 2.0, default = ToEven) | ||
261 | public int llRound(double f) | 262 | public int llRound(double f) |
262 | { | 263 | { |
263 | m_host.AddScriptLPS(1); | 264 | m_host.AddScriptLPS(1); |
264 | return (int)Math.Round(f, 0); | 265 | return (int)Math.Round(f, MidpointRounding.AwayFromZero); |
265 | } | 266 | } |
266 | 267 | ||
267 | //This next group are vector operations involving squaring and square root. ckrinke | 268 | //This next group are vector operations involving squaring and square root. ckrinke |
@@ -2926,11 +2927,13 @@ namespace OpenSim.Region.ScriptEngine.Common | |||
2926 | return (double)Math.Asin(val); | 2927 | return (double)Math.Asin(val); |
2927 | } | 2928 | } |
2928 | 2929 | ||
2930 | // Xantor 30/apr/2008 | ||
2929 | public double llAngleBetween(LSL_Types.Quaternion a, LSL_Types.Quaternion b) | 2931 | public double llAngleBetween(LSL_Types.Quaternion a, LSL_Types.Quaternion b) |
2930 | { | 2932 | { |
2931 | m_host.AddScriptLPS(1); | 2933 | m_host.AddScriptLPS(1); |
2932 | NotImplemented("llAngleBetween"); | 2934 | |
2933 | return 0; | 2935 | return (double) Math.Acos(a.x * b.x + a.y * b.y + a.z * b.z + a.s * b.s) * 2; |
2936 | // NotImplemented("llAngleBetween"); | ||
2934 | } | 2937 | } |
2935 | 2938 | ||
2936 | public string llGetInventoryKey(string name) | 2939 | public string llGetInventoryKey(string name) |