From 7bcdec4e8f433d0664518a7b9050f3cc1da1db20 Mon Sep 17 00:00:00 2001 From: Adam Frisby Date: Thu, 1 May 2008 12:11:34 +0000 Subject: * Applying Mantis#1097 - Thanks Xantor! - Fix for llRound (now rounds in LL-compatible fashion, rather than using bankers rounding) - Implementation of llAngleBetween --- OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs') 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 return (int)Math.Ceiling(f); } + // Xantor 01/May/2008 fixed midpointrounding (2.5 becomes 3.0 instead of 2.0, default = ToEven) public int llRound(double f) { m_host.AddScriptLPS(1); - return (int)Math.Round(f, 0); + return (int)Math.Round(f, MidpointRounding.AwayFromZero); } //This next group are vector operations involving squaring and square root. ckrinke @@ -2926,11 +2927,13 @@ namespace OpenSim.Region.ScriptEngine.Common return (double)Math.Asin(val); } + // Xantor 30/apr/2008 public double llAngleBetween(LSL_Types.Quaternion a, LSL_Types.Quaternion b) { m_host.AddScriptLPS(1); - NotImplemented("llAngleBetween"); - return 0; + + return (double) Math.Acos(a.x * b.x + a.y * b.y + a.z * b.z + a.s * b.s) * 2; +// NotImplemented("llAngleBetween"); } public string llGetInventoryKey(string name) -- cgit v1.1