Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (function () {
- return {
- 'add': (x, y) => { return [x[0] + y[0], x[1] + y[1]] },
- 'multiply': (x, scalar) => { return [x[0] * scalar, x[1] * scalar] },
- 'length': (x) => { return Math.sqrt(x[0] ** 2 + x[1] ** 2) },
- 'dot': (x, y) => { return (x[0] * y[0]) + (x[1] * y[1]) },
- 'cross': (x, y) => { return (x[0] * y[1]) - (y[0] * x[1]) }
- }
- })()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement