---
--- Generated by EmmyLua(https://github.com/EmmyLua)
--- Created by HUAFEI2.
--- DateTime: 2020/6/28 17:44
---

---@class LQuaternion
LQuaternion = LQuaternion or class("LQuaternion", LVec4);

---@param x number
---@param y number
---@param z number
---@param w number
function LQuaternion:ctor(x, y, z, w)
    --
end

---@param vecOut_Yaw_Pitch_Roll LVec3
---@return LQuaternion
function LQuaternion:ToEuler(vecOut_Yaw_Pitch_Roll)
    local quat = self;
    vecOut_Yaw_Pitch_Roll.x = math.atan2(2.0 * (quat.w * quat.z + quat.x * quat.y), 1.0 - 2.0 * (quat.z * quat.z + quat.x * quat.x));
    vecOut_Yaw_Pitch_Roll.y = math.asin(math.clamp(2.0 * (quat.w * quat.x - quat.y * quat.z), -1.0, 1.0));
    vecOut_Yaw_Pitch_Roll.z = math.atan2(2.0 * (quat.w * quat.y + quat.z * quat.x), 1.0 - 2.0 * (quat.x * quat.x + quat.y * quat.y));
    return self;
end

---@param {KQUATERNION} q
function LQuaternion:CopyFrom(q)
    self.x = q.x;
    self.y = q.y;
    self.z = q.z;
    self.w = q.w;
end

---@return LQuaternion
function LQuaternion:Clone()
    return LQuaternion:new(self.x, self.y, self.z, self.w);
end
