Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (() => {
- let add = (v1, v2) => [v1[0] + v2[0], v1[1] + v2[1]];
- let multiply = (v1, sc) => [v1[0] * sc, v1[1] * sc];
- let length = (v1) => Math.sqrt(Math.pow(v1[0], 2) + Math.pow(v1[1], 2));
- let dot = (v1, v2) => v1[0] * v2[0] + v1[1] * v2[1];
- let cross = (v1, v2) => v1[0] * v2[1] - v1[1] * v2[0];
- return {add, multiply, length, dot, cross};
- })();
Advertisement
Add Comment
Please, Sign In to add comment