export function cross(a, b) { return [ a[1] * b[2] - a[2] * b[1], a[2] * b[0] - a[0] * b[2], a[0] * b[1] - a[1] * b[0], ]; } export function diff(a, b) { return [ a[0] - b[0], a[1] - b[1], a[2] - b[2], ]; } export function add(a, b) { return [ a[0] + b[0], a[1] + b[1], a[2] + b[2], ]; } export function norm(a) { return Math.sqrt(a[0] ** 2 + a[1] ** 2 + a[2] ** 2); } export function dot(a, b) { return a[0] * b[0] + a[1] * b[1] + a[2] * b[2]; } export function scale(a, s) { return [ a[0] * s, a[1] * s, a[2] * s, ]; }