aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authordahlia2010-07-08 10:06:08 -0700
committerdahlia2010-07-08 10:06:08 -0700
commitdf9d4cd9b2cf97df6b8dc317868ae0eba1027b6b (patch)
treeff95c79216b83d8541d086a3a8dc354e82020d3a /OpenSim
parentfix a potential division by zero (diff)
downloadopensim-SC_OLD-df9d4cd9b2cf97df6b8dc317868ae0eba1027b6b.zip
opensim-SC_OLD-df9d4cd9b2cf97df6b8dc317868ae0eba1027b6b.tar.gz
opensim-SC_OLD-df9d4cd9b2cf97df6b8dc317868ae0eba1027b6b.tar.bz2
opensim-SC_OLD-df9d4cd9b2cf97df6b8dc317868ae0eba1027b6b.tar.xz
llVecNorm() now returns a zero-length vector when one is supplied as input. Addresses Mantis #4752
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs9
1 files changed, 2 insertions, 7 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index 0a8d7cb..5941abd 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -450,13 +450,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
450 450
451 public LSL_Vector llVecNorm(LSL_Vector v) 451 public LSL_Vector llVecNorm(LSL_Vector v)
452 { 452 {
453 m_host.AddScriptLPS(1); 453 m_host.AddScriptLPS(1);
454 double mag = LSL_Vector.Mag(v); 454 return LSL_Vector.Norm(v);
455 LSL_Vector nor = new LSL_Vector();
456 nor.x = v.x / mag;
457 nor.y = v.y / mag;
458 nor.z = v.z / mag;
459 return nor;
460 } 455 }
461 456
462 public LSL_Float llVecDist(LSL_Vector a, LSL_Vector b) 457 public LSL_Float llVecDist(LSL_Vector a, LSL_Vector b)