From 49a2cfacb98fa77a2ff44e5590815c00c7798cd6 Mon Sep 17 00:00:00 2001 From: SignpostMarv Date: Sat, 18 Aug 2012 14:49:10 +0100 Subject: [PATCH] Implementing operators & constructors for Quaternion --- .../Region/ScriptEngine/Shared/LSL_Types.cs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs b/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs index a4f4d265a5..cf57dbe463 100644 --- a/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs +++ b/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs @@ -361,6 +361,14 @@ namespace OpenSim.Region.ScriptEngine.Shared s = 1; } + public Quaternion(OMV_Quaternion rot) + { + x = rot.X; + y = rot.Y; + z = rot.Z; + s = rot.W; + } + #endregion #region Overriders @@ -407,6 +415,16 @@ namespace OpenSim.Region.ScriptEngine.Shared 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) { // Return true if the fields match: