llRot2Angle now checks absolute value of s rotation component before normalizing
parent
b242ead6df
commit
9d9b9d4938
|
@ -4688,19 +4688,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
{
|
{
|
||||||
m_host.AddScriptLPS(1);
|
m_host.AddScriptLPS(1);
|
||||||
|
|
||||||
if (rot.s > 1) // normalization needed
|
if (Math.Abs(rot.s) > 1) // normalization needed
|
||||||
{
|
rot.Normalize();
|
||||||
double length = Math.Sqrt(rot.x * rot.x + rot.y * rot.y +
|
|
||||||
rot.z * rot.z + rot.s * rot.s);
|
|
||||||
|
|
||||||
rot.x /= length;
|
|
||||||
rot.y /= length;
|
|
||||||
rot.z /= length;
|
|
||||||
rot.s /= length;
|
|
||||||
}
|
|
||||||
|
|
||||||
double angle = 2 * Math.Acos(rot.s);
|
double angle = 2 * Math.Acos(rot.s);
|
||||||
if ((double.IsNaN(angle)) || double.IsInfinity(angle)) angle = 0;
|
|
||||||
return angle;
|
return angle;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue