random drive-by maths optimization in llRot2Euler() and llEuler2Rot()

remotes/origin/0.6.7-post-fixes
dahlia 2009-09-07 17:12:17 -07:00
parent fa1d79533e
commit 7a67b726d5
1 changed files with 8 additions and 8 deletions

View File

@ -497,9 +497,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
NormalizeAngle(Math.Atan2(n, Math.Sqrt(p))),
NormalizeAngle(Math.Atan2(2.0 * (r.z * r.s - r.x * r.y), (t.x - t.y - t.z + t.s))));
else if (n > 0)
return new LSL_Vector(0.0, Math.PI / 2, NormalizeAngle(Math.Atan2((r.z * r.s + r.x * r.y), 0.5 - t.x - t.z)));
return new LSL_Vector(0.0, Math.PI * 0.5, NormalizeAngle(Math.Atan2((r.z * r.s + r.x * r.y), 0.5 - t.x - t.z)));
else
return new LSL_Vector(0.0, -Math.PI / 2, NormalizeAngle(Math.Atan2((r.z * r.s + r.x * r.y), 0.5 - t.x - t.z)));
return new LSL_Vector(0.0, -Math.PI * 0.5, NormalizeAngle(Math.Atan2((r.z * r.s + r.x * r.y), 0.5 - t.x - t.z)));
}
/* From wiki:
@ -553,12 +553,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
double x,y,z,s;
double c1 = Math.Cos(v.x/2.0);
double c2 = Math.Cos(v.y/2.0);
double c3 = Math.Cos(v.z/2.0);
double s1 = Math.Sin(v.x/2.0);
double s2 = Math.Sin(v.y/2.0);
double s3 = Math.Sin(v.z/2.0);
double c1 = Math.Cos(v.x * 0.5);
double c2 = Math.Cos(v.y * 0.5);
double c3 = Math.Cos(v.z * 0.5);
double s1 = Math.Sin(v.x * 0.5);
double s2 = Math.Sin(v.y * 0.5);
double s3 = Math.Sin(v.z * 0.5);
x = s1*c2*c3+c1*s2*s3;
y = c1*s2*c3-s1*c2*s3;