UNPKG

vectors

Version:

A grab bag of vector utility functions for 2D and 3D vectors that operate on plain arrays

13 lines (11 loc) 283 B
module.exports = crossn function crossn(vec, other) { return vec.length < 3 ? ( vec[0] * other[1] - vec[1] * other[0] ) : [ (vec[1] * other[2]) - (vec[2] * other[1]), (vec[2] * other[0]) - (vec[0] * other[2]), (vec[0] * other[1]) - (vec[1] * other[0]) ] }