diff options
author | Melanie | 2010-07-08 17:32:57 +0100 |
---|---|---|
committer | Melanie | 2010-07-08 17:32:57 +0100 |
commit | 5f400a50beb2b9d523e5a0fac643ca1cb247c9a6 (patch) | |
tree | da874e34ef1c790f9b8ce9dc0533ac98755d783c /OpenSim/Region/ScriptEngine | |
parent | minimizes temp garbage for llParseStringKeepNulls() (diff) | |
parent | llVecNorm() now returns a zero-length vector when one is supplied as input. A... (diff) | |
download | opensim-SC-5f400a50beb2b9d523e5a0fac643ca1cb247c9a6.zip opensim-SC-5f400a50beb2b9d523e5a0fac643ca1cb247c9a6.tar.gz opensim-SC-5f400a50beb2b9d523e5a0fac643ca1cb247c9a6.tar.bz2 opensim-SC-5f400a50beb2b9d523e5a0fac643ca1cb247c9a6.tar.xz |
Merge branch 'master' into careminster-presence-refactor
Diffstat (limited to 'OpenSim/Region/ScriptEngine')
-rw-r--r-- | OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 9 | ||||
-rw-r--r-- | OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs | 13 |
2 files changed, 11 insertions, 11 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index b335ae6..f996ff4 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | |||
@@ -518,13 +518,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
518 | 518 | ||
519 | public LSL_Vector llVecNorm(LSL_Vector v) | 519 | public LSL_Vector llVecNorm(LSL_Vector v) |
520 | { | 520 | { |
521 | m_host.AddScriptLPS(1); | 521 | m_host.AddScriptLPS(1); |
522 | double mag = LSL_Vector.Mag(v); | 522 | return LSL_Vector.Norm(v); |
523 | LSL_Vector nor = new LSL_Vector(); | ||
524 | nor.x = v.x / mag; | ||
525 | nor.y = v.y / mag; | ||
526 | nor.z = v.z / mag; | ||
527 | return nor; | ||
528 | } | 523 | } |
529 | 524 | ||
530 | public LSL_Float llVecDist(LSL_Vector a, LSL_Vector b) | 525 | public LSL_Float llVecDist(LSL_Vector a, LSL_Vector b) |
diff --git a/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs b/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs index 5927973..01141ee 100644 --- a/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs +++ b/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs | |||
@@ -259,10 +259,15 @@ namespace OpenSim.Region.ScriptEngine.Shared | |||
259 | return Math.Sqrt(v.x * v.x + v.y * v.y + v.z * v.z); | 259 | return Math.Sqrt(v.x * v.x + v.y * v.y + v.z * v.z); |
260 | } | 260 | } |
261 | 261 | ||
262 | public static Vector3 Norm(Vector3 vector) | 262 | public static Vector3 Norm(Vector3 vector) |
263 | { | 263 | { |
264 | double mag = Mag(vector); | 264 | double mag = Mag(vector); |
265 | return new Vector3(vector.x / mag, vector.y / mag, vector.z / mag); | 265 | if (mag > 0.0) |
266 | { | ||
267 | double invMag = 1.0 / mag; | ||
268 | return vector * invMag; | ||
269 | } | ||
270 | return new Vector3(0, 0, 0); | ||
266 | } | 271 | } |
267 | 272 | ||
268 | #endregion | 273 | #endregion |