diff options
author | Matthew Kosarek <matthew.kosarek@vention.cc> | 2021-03-02 20:03:02 -0500 |
---|---|---|
committer | Matthew Kosarek <matthew.kosarek@vention.cc> | 2021-03-02 20:03:02 -0500 |
commit | a315509189073cdaf4172bcfd4e4a54e5c8c87eb (patch) | |
tree | 2fc57ae4c86d430a3478e012ae10bacee0b7ba41 /frontend/_shared/math/vec2.js | |
parent | d1b528b01796601c2bfea7b1a9813e5907e1c728 (diff) |
Updated stylings and very nearly have square collisions complete and proper
Diffstat (limited to 'frontend/_shared/math/vec2.js')
-rw-r--r-- | frontend/_shared/math/vec2.js | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/frontend/_shared/math/vec2.js b/frontend/_shared/math/vec2.js index cff38ce..11e71cd 100644 --- a/frontend/_shared/math/vec2.js +++ b/frontend/_shared/math/vec2.js @@ -53,4 +53,12 @@ function negate2(v) { x: -v.x, y: -v.y }; +} + +// Algorithm plucked from: https://matthew-brett.github.io/teaching/rotation_2d.html +function rotateAboutOrigin2(v, angle) { + return { + x: v.x * Math.cos(angle) - v.y * Math.sin(angle), + y: v.x * Math.sin(angle) + v.y * Math.cos(angle), + }; }
\ No newline at end of file |