// L=============================================================================
// L This software is distributed under the MIT license.
// L Copyright 2021 Péter Kardos
// L=============================================================================
#pragma once
#include "QuaternionImpl.hpp"
namespace mathter {
/// Rotates (and scales) vector by quaternion.
template
Vector operator*(const Quaternion& q, const Vector& vec) {
// sandwich product
return Vector(q * Quaternion(vec) * Inverse(q));
}
/// Rotates (and scales) vector by quaternion.
template
Vector operator*(const Vector& vec, const Quaternion& q) {
// sandwich product
return Vector(q * Quaternion(vec) * Inverse(q));
}
/// Rotates (and scales) vector by quaternion.
template
Vector& operator*=(Vector& vec, const Quaternion& q) {
// sandwich product
return vec = Vector(q * Quaternion(vec) * Inverse(q));
}
} // namespace mathter