Exemplo n.º 1
0
void Quaternion::setAxis(const Direction3D& axis)
{
    Direction3D axis_ = axis.normalize();

    float sha = std::sin(std::acos(w));

    x = axis_.x * sha;
    y = axis_.y * sha;
    z = axis_.z * sha;
}
Exemplo n.º 2
0
void Quaternion::setAxisAndAngle(const Direction3D& axis, float angle)
{
    Direction3D axis_ = axis.normalize();

    float sha = std::sin(angle / 2.0f);

    x = axis_.x * sha;
    y = axis_.y * sha;
    z = axis_.z * sha;
    w = std::cos(angle / 2.0f);
}