aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine/Shared
diff options
context:
space:
mode:
authordahlia2010-07-08 10:17:28 -0700
committerdahlia2010-07-08 10:17:28 -0700
commitc7a2e1b2d40dff80bf7b65ee01b9e7916de0f5e4 (patch)
treebdb39d1533f28814f306a57401b5619c0114c1fc /OpenSim/Region/ScriptEngine/Shared
parentfix a potential division by zero (diff)
downloadopensim-SC-c7a2e1b2d40dff80bf7b65ee01b9e7916de0f5e4.zip
opensim-SC-c7a2e1b2d40dff80bf7b65ee01b9e7916de0f5e4.tar.gz
opensim-SC-c7a2e1b2d40dff80bf7b65ee01b9e7916de0f5e4.tar.bz2
opensim-SC-c7a2e1b2d40dff80bf7b65ee01b9e7916de0f5e4.tar.xz
llVecNorm() now returns a zero-length vector when one is supplied as input. Addresses Mantis #4752
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Shared')
-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 e4e087f..eaaa9eb 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)