cross function
Returns the cross-product of three vectors in a 4-dimensional space
@param {ReadonlyVec4} result the receiving vector @param {ReadonlyVec4} U the first vector @param {ReadonlyVec4} V the second vector @param {ReadonlyVec4} W the third vector @returns {vec4} result
Implementation
List<double> cross(List<double> out, List<double> u, List<double> v, List<double> w) {
final A = v[0] * w[1] - v[1] * w[0],
B = v[0] * w[2] - v[2] * w[0],
C = v[0] * w[3] - v[3] * w[0],
D = v[1] * w[2] - v[2] * w[1],
E = v[1] * w[3] - v[3] * w[1],
F = v[2] * w[3] - v[3] * w[2];
final G = u[0];
final H = u[1];
final I = u[2];
final J = u[3];
out[0] = H * F - I * E + J * D;
out[1] = -(G * F) + I * C - J * B;
out[2] = G * E - H * C + J * A;
out[3] = -(G * D) + H * B - I * A;
return out;
}