|
@@ -272,6 +272,33 @@
|
|
|
return otherVector && this.x === otherVector.x && this.y === otherVector.y;
|
|
|
}
|
|
|
|
|
|
+ public multiplyInPlace(otherVector: Vector2): void {
|
|
|
+ this.x *= otherVector.x;
|
|
|
+ this.y *= otherVector.y;
|
|
|
+ }
|
|
|
+
|
|
|
+ public multiply(otherVector: Vector2): Vector2 {
|
|
|
+ return new Vector2(this.x * otherVector.x, this.y * otherVector.y);
|
|
|
+ }
|
|
|
+
|
|
|
+ public multiplyToRef(otherVector: Vector2, result: Vector2): void {
|
|
|
+ result.x = this.x * otherVector.x;
|
|
|
+ result.y = this.y * otherVector.y;
|
|
|
+ }
|
|
|
+
|
|
|
+ public multiplyByFloats(x: number, y: number): Vector2 {
|
|
|
+ return new Vector2(this.x * x, this.y * y);
|
|
|
+ }
|
|
|
+
|
|
|
+ public divide(otherVector: Vector2): Vector2 {
|
|
|
+ return new Vector2(this.x / otherVector.x, this.y / otherVector.y);
|
|
|
+ }
|
|
|
+
|
|
|
+ public divideToRef(otherVector: Vector2, result: Vector2): void {
|
|
|
+ result.x = this.x / otherVector.x;
|
|
|
+ result.y = this.y / otherVector.y;
|
|
|
+ }
|
|
|
+
|
|
|
// Properties
|
|
|
public length(): number {
|
|
|
return Math.sqrt(this.x * this.x + this.y * this.y);
|