Implementing operators & constructors for Quaternion

0.7.4-extended
SignpostMarv 2012-08-18 14:49:10 +01:00 committed by Justin Clark-Casey (justincc)
parent 4a35f0a305
commit 49a2cfacb9
1 changed files with 18 additions and 0 deletions

View File

@ -361,6 +361,14 @@ namespace OpenSim.Region.ScriptEngine.Shared
s = 1; s = 1;
} }
public Quaternion(OMV_Quaternion rot)
{
x = rot.X;
y = rot.Y;
z = rot.Z;
s = rot.W;
}
#endregion #endregion
#region Overriders #region Overriders
@ -407,6 +415,16 @@ namespace OpenSim.Region.ScriptEngine.Shared
return new list(new object[] { r }); return new list(new object[] { r });
} }
public static implicit operator OMV_Quaternion(Quaternion rot)
{
return new OMV_Quaternion((float)rot.x, (float)rot.y, (float)rot.z, (float)rot.s);
}
public static implicit operator Quaternion(OMV_Quaternion rot)
{
return new Quaternion(rot);
}
public static bool operator ==(Quaternion lhs, Quaternion rhs) public static bool operator ==(Quaternion lhs, Quaternion rhs)
{ {
// Return true if the fields match: // Return true if the fields match: