Merge branch 'master' into careminster

Conflicts:
	OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
	OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiTest.cs
This commit is contained in:
Melanie
2012-01-06 21:41:36 +00:00
8 changed files with 451 additions and 47 deletions

View File

@@ -5096,15 +5096,19 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
return (double)Math.Asin(val);
}
// Xantor 30/apr/2008
// jcochran 5/jan/2012
public LSL_Float llAngleBetween(LSL_Rotation a, LSL_Rotation b)
{
m_host.AddScriptLPS(1);
double angle = Math.Acos(a.x * b.x + a.y * b.y + a.z * b.z + a.s * b.s) * 2;
if (angle < 0) angle = -angle;
if (angle > Math.PI) return (Math.PI * 2 - angle);
return angle;
double aa = (a.x * a.x + a.y * a.y + a.z * a.z + a.s * a.s);
double bb = (b.x * b.x + b.y * b.y + b.z * b.z + b.s * b.s);
double aa_bb = aa * bb;
if (aa_bb == 0) return 0.0;
double ab = (a.x * b.x + a.y * b.y + a.z * b.z + a.s * b.s);
double quotient = (ab * ab) / aa_bb;
if (quotient >= 1.0) return 0.0;
return Math.Acos(2 * quotient - 1);
}
public LSL_String llGetInventoryKey(string name)