From a315509189073cdaf4172bcfd4e4a54e5c8c87eb Mon Sep 17 00:00:00 2001 From: Matthew Kosarek Date: Tue, 2 Mar 2021 20:03:02 -0500 Subject: Updated stylings and very nearly have square collisions complete and proper --- frontend/_shared/math/vec2.js | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'frontend/_shared/math/vec2.js') 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 -- cgit v1.2.1