aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine
diff options
context:
space:
mode:
authorJeff Ames2008-03-11 22:15:28 +0000
committerJeff Ames2008-03-11 22:15:28 +0000
commit6da664edbead5d0a39a830b9ce8688e064e6fc8f (patch)
tree5cb5b7d8ee373b9af32940d7f8116013848eda08 /OpenSim/Region/ScriptEngine
parentUpdate svn properties. (diff)
downloadopensim-SC_OLD-6da664edbead5d0a39a830b9ce8688e064e6fc8f.zip
opensim-SC_OLD-6da664edbead5d0a39a830b9ce8688e064e6fc8f.tar.gz
opensim-SC_OLD-6da664edbead5d0a39a830b9ce8688e064e6fc8f.tar.bz2
opensim-SC_OLD-6da664edbead5d0a39a830b9ce8688e064e6fc8f.tar.xz
Refactor out some duplicate code.
Diffstat (limited to 'OpenSim/Region/ScriptEngine')
-rw-r--r--OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs4
-rw-r--r--OpenSim/Region/ScriptEngine/Common/LSL_Types.cs6
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
191 public double llVecMag(LSL_Types.Vector3 v) 191 public double llVecMag(LSL_Types.Vector3 v)
192 { 192 {
193 m_host.AddScriptLPS(1); 193 m_host.AddScriptLPS(1);
194 return Math.Sqrt(v.x * v.x + v.y * v.y + v.z * v.z); 194 return LSL_Types.Vector3.Mag(v);
195 } 195 }
196 196
197 public LSL_Types.Vector3 llVecNorm(LSL_Types.Vector3 v) 197 public LSL_Types.Vector3 llVecNorm(LSL_Types.Vector3 v)
198 { 198 {
199 m_host.AddScriptLPS(1); 199 m_host.AddScriptLPS(1);
200 double mag = Math.Sqrt(v.x * v.x + v.y * v.y + v.z * v.z); 200 double mag = LSL_Types.Vector3.Mag(v);
201 LSL_Types.Vector3 nor = new LSL_Types.Vector3(); 201 LSL_Types.Vector3 nor = new LSL_Types.Vector3();
202 nor.x = v.x / mag; 202 nor.x = v.x / mag;
203 nor.y = v.y / mag; 203 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
231 ); 231 );
232 } 232 }
233 233
234 public static float Mag(Vector3 v) 234 public static double Mag(Vector3 v)
235 { 235 {
236 return (float)Math.Sqrt(v.x * v.x + v.y * v.y + v.z * v.z); 236 return Math.Sqrt(v.x * v.x + v.y * v.y + v.z * v.z);
237 } 237 }
238 238
239 public static Vector3 Norm(Vector3 vector) 239 public static Vector3 Norm(Vector3 vector)
240 { 240 {
241 float mag = Mag(vector); 241 double mag = Mag(vector);
242 return new Vector3(vector.x / mag, vector.y / mag, vector.z / mag); 242 return new Vector3(vector.x / mag, vector.y / mag, vector.z / mag);
243 } 243 }
244 244