diff options
author | Matthew Kosarek <matthew.kosarek@vention.cc> | 2021-02-23 19:39:16 -0500 |
---|---|---|
committer | Matthew Kosarek <matthew.kosarek@vention.cc> | 2021-02-23 19:39:16 -0500 |
commit | f0d1398b0d1b1a7c5bd1d4e0b3488b7f1aa74364 (patch) | |
tree | 4279b063052fb71ef5ff34a2f2f93d5c7b870b98 /frontend/_rigidbody/vec2.js | |
parent | ece2b67aa689aee0b881bac17a62c16e0469bc56 (diff) |
Big rework of the directory structure to make it more orderly for my brain
Diffstat (limited to 'frontend/_rigidbody/vec2.js')
-rw-r--r-- | frontend/_rigidbody/vec2.js | 55 |
1 files changed, 0 insertions, 55 deletions
diff --git a/frontend/_rigidbody/vec2.js b/frontend/_rigidbody/vec2.js deleted file mode 100644 index 2db42e0..0000000 --- a/frontend/_rigidbody/vec2.js +++ /dev/null @@ -1,55 +0,0 @@ -function vec2(x = 0, y = 0) { - return { x: x, y: y}; -} - -function addVec2(v1, v2) { - return { - x: v1.x + v2.x, - y: v1.y + v2.y - }; -} - -function subVec2(v1, v2) { - return { - x: v1.x - v2.x, - y: v1.y - v2.y - }; -} - -function scaleVec2(v, s) { - return { - x: v.x * s, - y: v.y * s - }; -} - -function dot2(v1, v2) { - return v1.x * v2.x + v1.y * v2.y; -} - -function length2(v) { - return Math.sqrt(v.x * v.x + v.y * v.y); -} - -function normalize2(v) { - const lLength = 1.0 / length2(v); - return { x: v.x * lLength, y: v.y * lLength }; -} - -function vec2str(v) { - return `(${v.x.toFixed(2)}, ${v.y.toFixed(2)})`; -} - -function getPerp2(v) { - return { - x: -v.y, - y: v.x - }; -} - -function negate2(v) { - return { - x: -v.x, - y: -v.y - }; -}
\ No newline at end of file |