From 2ecbd6d4b41dcd8e3615338c9d961e841abed1b5 Mon Sep 17 00:00:00 2001 From: Matei Adriel Date: Sun, 20 Jan 2019 14:36:47 +0200 Subject: [PATCH] javascript(ultra32): added rotate Signed-off-by: prescientmoon --- javascript/ultra32/.gitignore | 64 ++--------------------------------- javascript/ultra32/app.js | 7 ++++ 2 files changed, 10 insertions(+), 61 deletions(-) diff --git a/javascript/ultra32/.gitignore b/javascript/ultra32/.gitignore index ad46b30..16fdf4d 100644 --- a/javascript/ultra32/.gitignore +++ b/javascript/ultra32/.gitignore @@ -1,61 +1,3 @@ -# Logs -logs -*.log -npm-debug.log* -yarn-debug.log* -yarn-error.log* - -# Runtime data -pids -*.pid -*.seed -*.pid.lock - -# Directory for instrumented libs generated by jscoverage/JSCover -lib-cov - -# Coverage directory used by tools like istanbul -coverage - -# nyc test coverage -.nyc_output - -# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) -.grunt - -# Bower dependency directory (https://bower.io/) -bower_components - -# node-waf configuration -.lock-wscript - -# Compiled binary addons (https://nodejs.org/api/addons.html) -build/Release - -# Dependency directories -node_modules/ -jspm_packages/ - -# TypeScript v1 declaration files -typings/ - -# Optional npm cache directory -.npm - -# Optional eslint cache -.eslintcache - -# Optional REPL history -.node_repl_history - -# Output of 'npm pack' -*.tgz - -# Yarn Integrity file -.yarn-integrity - -# dotenv environment variables file -.env - -# next.js build output -.next +node_modules +app.ts +tsconfig.json diff --git a/javascript/ultra32/app.js b/javascript/ultra32/app.js index d0e2546..b9849ea 100644 --- a/javascript/ultra32/app.js +++ b/javascript/ultra32/app.js @@ -35,3 +35,10 @@ function mirror(vector) { return vector; } exports.mirror = mirror; +function rotate(vector) { + const oldx = vector[0]; + vector[0] = Math.cos(vector[0]) - Math.sin(vector[1]); + vector[1] = Math.sin(oldx) + Math.cos(vector[1]); + return vector; +} +exports.rotate = rotate;