Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | 1x 1x 1x 1x 1x 3x 1x 2x 2x 2x 1x 2x 1x 2x 1x 1x | import { IVector2, Vector2 } from "../models/vector2.js" declare module "../models/vector2.js" { interface IVector2 { set(vector: IVector2): void; getLength(): number; getNormalize(): IVector2; getScalar(vector: IVector2): number; } interface Vector2 extends IVector2 { } } Vector2.prototype.set = function (vector: IVector2): void { this.x = vector.x; this.y = vector.y; } Vector2.prototype.getLength = function (): number { return Math.sqrt( (this.x * this.x) + (this.y * this.y)); } Vector2.prototype.getNormalize = function (): IVector2 { const length = this.getLength(); const nomalized = new Vector2(); if (this.x != 0) nomalized.x = this.x / length; if (this.y != 0) nomalized.y = this.y / length; return nomalized; } Vector2.prototype.getScalar = function (vector: IVector2): number { return this.x * vector.x + this.y * vector.y; } |