All files ArrayVector.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 331x                 1x       38x 38x 38x     1x 92x     23x     1x 88x     23x   1x  
import { AbstractVector } from "./AbstractVector"
 
/**
 * A vector representation that stores the axes in an Array
 *
 * ```
 * const v = new Vec2D.ArrayVector(2, 5)
 * ```
 */
export class ArrayVector extends AbstractVector {
  protected axes: number[]
 
  constructor(x: number, y: number) {
    super(ArrayVector)
    this.axes = [x, y]
    this.ctor = ArrayVector
  }
 
  get x(): number {
    return this.axes[0]
  }
  set x(x: number) {
    this.axes[0] = x
  }
 
  get y(): number {
    return this.axes[1]
  }
  set y(y: number) {
    this.axes[1] = y
  }
}