static MyQuaternion identity() { return MyQuaternion(0,0,0,1); }
//{ Special functions MyQuaternion inverse() const { return MyQuaternion(-MyVector4<T>::x, -MyVector4<T>::y, -MyVector4<T>::z, MyVector4<T>::w); };
MyQuaternion MyQuaternion::operator*(const MyQuaternion &operand) const { return MyQuaternion(a * operand.a - b * operand.b - c * operand.c - d * operand.d, a * operand.b + b * operand.a + c * operand.d - d * operand.c, a * operand.c - b * operand.d + c * operand.a + d * operand.b, a * operand.d + b * operand.c - c * operand.b + d * operand.a); }
MyQuaternion MyQuaternion::complement() const { return MyQuaternion(a, -b, -c, -d); }
MyQuaternion MyQuaternion::normalize() { double temp = std::sqrt(a * a + b * b + c * c + d * d); return MyQuaternion(a / temp, b / temp, c / temp, d / temp); }