diff --git a/src/lol/math/vector.h b/src/lol/math/vector.h index 1261f6b2..eb2a35ac 100644 --- a/src/lol/math/vector.h +++ b/src/lol/math/vector.h @@ -1035,13 +1035,30 @@ template struct Quat return Quat(w, -x, -y, -z); } - inline Vec3 transform(Vec3 const &v) + inline Vec3 transform(Vec3 const &v) const { Quat p = Quat(0, v.x, v.y, v.z); Quat q = *this * p / *this; return Vec3(q.x, q.y, q.z); } + inline Vec4 transform(Vec4 const &v) const + { + Quat p = Quat(0, v.x, v.y, v.z); + Quat q = *this * p / *this; + return Vec4(q.x, q.y, q.z, v.w); + } + + inline Vec3 operator *(Vec3 const &v) const + { + return transform(v); + } + + inline Vec4 operator *(Vec4 const &v) const + { + return transform(v); + } + template friend std::ostream &operator<<(std::ostream &stream, Quat const &v);