All files Vector.ts

100% Statements 14/14
100% Branches 2/2
100% Functions 6/6
100% Lines 12/12

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 35 36    1x                 1x         38x 38x 38x     1x 92x     23x     1x 88x     23x   1x  
"use strict"
 
import { AbstractVector } from "./AbstractVector"
 
/**
 * A vector representation that stores the axes as part of the instance itself
 *
 * ```ts
 * const v = new Vec2D.Vector(2, 5)
 * ```
 */
export class Vector extends AbstractVector {
  protected _x: number
  protected _y: number
 
  constructor(x: number, y: number) {
    super(Vector)
    this._x = x
    this._y = y
  }
 
  get x(): number {
    return this._x
  }
  set x(x: number) {
    this._x = x
  }
 
  get y(): number {
    return this._y
  }
  set y(y: number) {
    this._y = y
  }
}