mirror of
https://github.com/opensim/opensim.git
synced 2026-08-01 22:26:09 +08:00
Merge branch 'master' into careminster
Conflicts: OpenSim/Capabilities/Handlers/GetTexture/GetTextureHandler.cs OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs OpenSim/Services/Connectors/Asset/AssetServicesConnector.cs
This commit is contained in:
@@ -5109,6 +5109,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
|
||||
s = Math.Cos(angle * 0.5);
|
||||
t = Math.Sin(angle * 0.5); // temp value to avoid 2 more sin() calcs
|
||||
axis = LSL_Vector.Norm(axis);
|
||||
x = axis.x * t;
|
||||
y = axis.y * t;
|
||||
z = axis.z * t;
|
||||
@@ -5149,7 +5150,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
y = rot.y / s;
|
||||
z = rot.z / s;
|
||||
}
|
||||
|
||||
if ((double.IsNaN(x)) || double.IsInfinity(x)) x = 0;
|
||||
if ((double.IsNaN(y)) || double.IsInfinity(y)) y = 0;
|
||||
if ((double.IsNaN(z)) || double.IsInfinity(z)) z = 0;
|
||||
return new LSL_Vector(x,y,z);
|
||||
}
|
||||
|
||||
@@ -5171,7 +5174,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
}
|
||||
|
||||
double angle = 2 * Math.Acos(rot.s);
|
||||
|
||||
if ((double.IsNaN(angle)) || double.IsInfinity(angle)) angle = 0;
|
||||
return angle;
|
||||
}
|
||||
|
||||
|
||||
@@ -371,6 +371,31 @@ namespace OpenSim.Region.ScriptEngine.Shared
|
||||
|
||||
#endregion
|
||||
|
||||
#region Methods
|
||||
public Quaternion Normalize()
|
||||
{
|
||||
double length = Math.Sqrt(x * x + y * y + z * z + s * s);
|
||||
if (length < float.Epsilon)
|
||||
{
|
||||
x = 1;
|
||||
y = 0;
|
||||
z = 0;
|
||||
s = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
double invLength = 1.0 / length;
|
||||
x *= invLength;
|
||||
y *= invLength;
|
||||
z *= invLength;
|
||||
s *= invLength;
|
||||
}
|
||||
|
||||
return this;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Overriders
|
||||
|
||||
public override int GetHashCode()
|
||||
|
||||
Reference in New Issue
Block a user