MCPcopy Create free account
hub / github.com/DjDeveloperr/deno_desktop / Vector2

Class Vector2

examples/extern/gmath.bundle.js:624–772  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

622 }
623}
624class Vector2 {
625 #internal = new Float32Array(2);
626 get [0]() {
627 return this.#internal[0];
628 }
629 set [0](val) {
630 this.#internal[0] = val;
631 }
632 get [1]() {
633 return this.#internal[1];
634 }
635 set [1](val) {
636 this.#internal[1] = val;
637 }
638 get x() {
639 return this.#internal[0];
640 }
641 set x(val) {
642 this.#internal[0] = val;
643 }
644 get y() {
645 return this.#internal[1];
646 }
647 set y(val) {
648 this.#internal[1] = val;
649 }
650 static negativeInfinity() {
651 return new Vector2(Number.NEGATIVE_INFINITY);
652 }
653 static positiveInfinity() {
654 return new Vector2(Number.POSITIVE_INFINITY);
655 }
656 static zero() {
657 return new Vector2(0);
658 }
659 static one() {
660 return new Vector2(1);
661 }
662 static up() {
663 return new Vector2(0, 1);
664 }
665 static down() {
666 return new Vector2(0, -1);
667 }
668 static left() {
669 return new Vector2(-1, 0);
670 }
671 static right() {
672 return new Vector2(1, 0);
673 }
674 constructor(x, y){
675 if (x !== undefined) {
676 this.x = x;
677 if (y !== undefined) {
678 this.y = y;
679 } else {
680 this.y = x;
681 }

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected