* Applying Mantis#1097 - Thanks Xantor!

- Fix for llRound (now rounds in LL-compatible fashion, rather than using bankers rounding)
- Implementation of llAngleBetween
0.6.0-stable
Adam Frisby 2008-05-01 12:11:34 +00:00
parent 9024fe68fc
commit 7bcdec4e8f
1 changed files with 6 additions and 3 deletions

View File

@ -258,10 +258,11 @@ namespace OpenSim.Region.ScriptEngine.Common
return (int)Math.Ceiling(f);
}
// Xantor 01/May/2008 fixed midpointrounding (2.5 becomes 3.0 instead of 2.0, default = ToEven)
public int llRound(double f)
{
m_host.AddScriptLPS(1);
return (int)Math.Round(f, 0);
return (int)Math.Round(f, MidpointRounding.AwayFromZero);
}
//This next group are vector operations involving squaring and square root. ckrinke
@ -2926,11 +2927,13 @@ namespace OpenSim.Region.ScriptEngine.Common
return (double)Math.Asin(val);
}
// Xantor 30/apr/2008
public double llAngleBetween(LSL_Types.Quaternion a, LSL_Types.Quaternion b)
{
m_host.AddScriptLPS(1);
NotImplemented("llAngleBetween");
return 0;
return (double) Math.Acos(a.x * b.x + a.y * b.y + a.z * b.z + a.s * b.s) * 2;
// NotImplemented("llAngleBetween");
}
public string llGetInventoryKey(string name)