diff options
author | dahlia | 2010-07-08 11:12:23 -0700 |
---|---|---|
committer | dahlia | 2010-07-08 11:12:23 -0700 |
commit | 5f932605dc7082761d0f830676e8a19fef802b45 (patch) | |
tree | ba9cb72a3b03683cb4215032dedd947d9e2fce80 /OpenSim/Region | |
parent | fix a potential division by zero (diff) | |
download | opensim-SC-5f932605dc7082761d0f830676e8a19fef802b45.zip opensim-SC-5f932605dc7082761d0f830676e8a19fef802b45.tar.gz opensim-SC-5f932605dc7082761d0f830676e8a19fef802b45.tar.bz2 opensim-SC-5f932605dc7082761d0f830676e8a19fef802b45.tar.xz |
llVecNorm() now returns a zero-length vector when one is supplied as input. Addresses Mantis #4752
Diffstat (limited to 'OpenSim/Region')
-rw-r--r-- | OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 9 |
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) |