All files Float32Vector.ts

100% Statements 15/15
100% Branches 2/2
100% Functions 6/6
100% Lines 13/13

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 341x                 1x       38x 38x 38x 38x     1x 92x     23x     1x 88x     23x   1x  
import { AbstractVector } from "./AbstractVector"
 
/**
 * A vector representation that stores the axes in a Float32Array
 *
 * ```
 * const v = new Vec2D.Float32Vector(2, 5)
 * ```
 */
export class Float32Vector extends AbstractVector {
  protected axes: Float32Array
 
  constructor(x: number, y: number) {
    super(Float32Vector)
    this.axes = new Float32Array(2)
    this.axes[0] = x
    this.axes[1] = y
  }
 
  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
  }
}