This commit is contained in:
Letter N
2020-07-21 17:47:43 +08:00
parent 9fa060de9e
commit d64c240da3
5 changed files with 154 additions and 12 deletions
+4 -10
View File
@@ -1,4 +1,8 @@
/**
* N-dimensional vector manipulation functions.
*
* Vectors are plain number arrays, i.e. [x, y, z].
*
* @file
* @copyright 2020 Aleksej Komarov
* @license MIT
@@ -6,16 +10,6 @@
import { map, reduce, zipWith } from './collections';
/**
* Creates a vector, with as many dimensions are there are arguments.
*/
export const vecCreate = (...components) => {
if (Array.isArray(components[0])) {
return [...components[0]];
}
return components;
};
const ADD = (a, b) => a + b;
const SUB = (a, b) => a - b;
const MUL = (a, b) => a * b;