From 6da664edbead5d0a39a830b9ce8688e064e6fc8f Mon Sep 17 00:00:00 2001 From: Jeff Ames Date: Tue, 11 Mar 2008 22:15:28 +0000 Subject: Refactor out some duplicate code. --- OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs | 4 ++-- OpenSim/Region/ScriptEngine/Common/LSL_Types.cs | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs b/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs index e332f0f..e64fb36 100644 --- a/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs +++ b/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs @@ -191,13 +191,13 @@ namespace OpenSim.Region.ScriptEngine.Common public double llVecMag(LSL_Types.Vector3 v) { m_host.AddScriptLPS(1); - return Math.Sqrt(v.x * v.x + v.y * v.y + v.z * v.z); + return LSL_Types.Vector3.Mag(v); } public LSL_Types.Vector3 llVecNorm(LSL_Types.Vector3 v) { m_host.AddScriptLPS(1); - double mag = Math.Sqrt(v.x * v.x + v.y * v.y + v.z * v.z); + double mag = LSL_Types.Vector3.Mag(v); LSL_Types.Vector3 nor = new LSL_Types.Vector3(); nor.x = v.x / mag; nor.y = v.y / mag; diff --git a/OpenSim/Region/ScriptEngine/Common/LSL_Types.cs b/OpenSim/Region/ScriptEngine/Common/LSL_Types.cs index ca2136b..c86c87a 100644 --- a/OpenSim/Region/ScriptEngine/Common/LSL_Types.cs +++ b/OpenSim/Region/ScriptEngine/Common/LSL_Types.cs @@ -231,14 +231,14 @@ namespace OpenSim.Region.ScriptEngine.Common ); } - public static float Mag(Vector3 v) + public static double Mag(Vector3 v) { - return (float)Math.Sqrt(v.x * v.x + v.y * v.y + v.z * v.z); + return Math.Sqrt(v.x * v.x + v.y * v.y + v.z * v.z); } public static Vector3 Norm(Vector3 vector) { - float mag = Mag(vector); + double mag = Mag(vector); return new Vector3(vector.x / mag, vector.y / mag, vector.z / mag); } -- cgit v1.1