Refactor out some duplicate code.

This commit is contained in:
Jeff Ames
2008-03-11 22:15:28 +00:00
parent c1bec32efc
commit 6da664edbe
2 changed files with 5 additions and 5 deletions

View File

@@ -191,13 +191,13 @@ namespace OpenSim.Region.ScriptEngine.Common
public double llVecMag(LSL_Types.Vector3 v)
{
m_host.AddScriptLPS(1);
return Math.Sqrt(v.x * v.x + v.y * v.y + v.z * v.z);
return LSL_Types.Vector3.Mag(v);
}
public LSL_Types.Vector3 llVecNorm(LSL_Types.Vector3 v)
{
m_host.AddScriptLPS(1);
double mag = Math.Sqrt(v.x * v.x + v.y * v.y + v.z * v.z);
double mag = LSL_Types.Vector3.Mag(v);
LSL_Types.Vector3 nor = new LSL_Types.Vector3();
nor.x = v.x / mag;
nor.y = v.y / mag;