summaryrefslogtreecommitdiff
path: root/2026/games/crm148/vec2.js
diff options
context:
space:
mode:
authorLLLL Colonq <llll@colonq>2026-08-17 20:14:16 -0400
committerLLLL Colonq <llll@colonq>2026-08-17 20:14:16 -0400
commitde99c5f7636a952025ea13de02bafd25bcb6bdec (patch)
treebe359424af4f6717103e3b667b6529ae5a4b4e6a /2026/games/crm148/vec2.js
parent4d4d1f24721f27fbf37e1070be6414de130ace61 (diff)
Fix broken
Diffstat (limited to '2026/games/crm148/vec2.js')
-rw-r--r--2026/games/crm148/vec2.js61
1 files changed, 0 insertions, 61 deletions
diff --git a/2026/games/crm148/vec2.js b/2026/games/crm148/vec2.js
deleted file mode 100644
index 230dad9..0000000
--- a/2026/games/crm148/vec2.js
+++ /dev/null
@@ -1,61 +0,0 @@
-
-export default class Vec2 {
- constructor(x, y) {
- this.x = x;
- this.y = y;
- }
-
- static zero() {
- return new Vec2(0, 0);
- }
-
- static fromHeading(radians) {
- return new Vec2(Math.cos(radians), Math.sin(radians));
- }
-
- static fromHeadingLength(radians, length) {
- return Vec2.fromHeading(radians).scale(length);
- }
-
- length() {
- return Math.sqrt(Math.pow(this.x, 2) + Math.pow(this.y, 2));
- }
-
- heading() {
- return Math.atan2(this.y, this.x);
- }
-
- scale(factor) {
- this.x *= factor;
- this.y *= factor;
- return this;
- }
-
- scaled(factor) {
- return new Vec2(this.x * factor, this.y * factor);
- }
-
- ofLength(newLength) {
- return this.normalized().scale(newLength);
- }
-
- add(v2) {
- return new Vec2(this.x + v2.x, this.y + v2.y);
- }
-
- sub(v2) {
- return new Vec2(this.x - v2.x, this.y - v2.y);
- }
-
- normalize() {
- var len = this.length();
- this.x = this.x / len;
- this.y = this.y / len;
- return this;
- }
-
- normalized() {
- var len = this.length();
- return new Vec2(this.x / len, this.y / len);
- }
-}