UNPKG

@fimbul-works/vec

Version:

A comprehensive TypeScript vector math library providing 2D, 3D, and 4D vector operations with a focus on performance and type safety.

8 lines (7 loc) 281 B
/** * Calculates the cross product of two 2D vectors. * @param {ArrayVector2D} xy1 - First vector as `[x, y]` * @param {ArrayVector2D} xy2 - Second vector as `[x, y]` * @returns {number} Cross product */ export const cross2D = (xy1, xy2) => xy1[0] * xy2[1] - xy1[1] * xy2[0];