previous constructor for Quat4
Quat4 math functions.
Almost all functions take an optional dst
argument. If it is not passed in the
functions will create a new Quat4
. In other words you can do this
const v = quat4.cross(v1, v2); // Creates a new Quat4 with the cross product of v1 x v2.
or
const v = quat4.create();
quat4.cross(v1, v2, v); // Puts the cross product of v1 x v2 in v
The first style is often easier but depending on where it's used it generates garbage where as there is almost never allocation with the second style.
It is always safe to pass any vector as the destination. So for example
quat4.cross(v1, v2, v1); // Puts the cross product of v1 x v2 in v1
Sets the type this library creates for a Quat4