diff --git a/src/Math/Vector3.h b/src/Math/Vector3.h index 84ff16050..88db8214b 100644 --- a/src/Math/Vector3.h +++ b/src/Math/Vector3.h @@ -20,6 +20,7 @@ */ #include "Vector2.h" +#include "Swizzle.h" namespace Magnum { namespace Math { @@ -98,9 +99,8 @@ template class Vector3: public Vector<3, T> { * @f] */ inline constexpr static Vector3 cross(const Vector3& a, const Vector3& b) { - return Vector3(a[1]*b[2]-a[2]*b[1], - a[2]*b[0]-a[0]*b[2], - a[0]*b[1]-a[1]*b[0]); + return swizzle<'y', 'z', 'x'>(a)*swizzle<'z', 'x', 'y'>(b) - + swizzle<'z', 'x', 'y'>(a)*swizzle<'y', 'z', 'x'>(b); } /** @copydoc Vector::Vector() */