Exemple #1
0
SE_Quat SE_Quat::inverse() const
{
    SE_Quat conj = conjugate();
    float len = length();
    if(len == 0)
    {
        return IDENTITY;
    }
    return SE_Quat(conj.x / len, conj.y / len, conj.z / len, conj.w / len);
}
Exemple #2
0
#include "SE_DynamicLibType.h"
#include "SE_Quat.h"
#include "SE_Math.h"
#include <math.h>
#include "SE_MemLeakDetector.h"
const SE_Quat SE_Quat::IDENTITY = SE_Quat(0, 0, 0, 1);
SE_Quat::SE_Quat(float angle, const SE_Vector3f& axis)
{
    set(angle, axis);
}
void SE_Quat::set(float angle, const SE_Vector3f& axis)
{
    if(axis.isZero())
    {
        identity();
        return;
    }
    SE_Vector3f axisNorm = axis.normalize();
    float radian = SE_AngleToRadian(angle) / 2;
    float sinRadian = SE_Sinf(radian);
    w = SE_Cosf(radian);
    x = axisNorm.x * sinRadian;
    y = axisNorm.y * sinRadian;
    z = axisNorm.z * sinRadian;
}
SE_Quat SE_Quat::conjugate() const
{
    return SE_Quat(-x, -y, -z, w);    
}
SE_Quat SE_Quat::mul(const SE_Quat& rq) const
{
Exemple #3
0
SE_Quat SE_Quat::conjugate() const
{
    return SE_Quat(-x, -y, -z, w);    
}
Exemple #4
0
SE_Quat SE_BufferInput::readQuat()
{
    SE_Vector4f v = readVector4f();
    return SE_Quat(v.x, v.y, v.z, v.w);
}