Options
All
  • Public
  • Public/Protected
  • All
Menu

Namespace helpers

Index

Functions

  • checkCoordsSizesCompability(coords: readonly number[], sizes: readonly number[]): void
  • Ensures that coords and dimensions sizes are compatible

    Parameters

    • coords: readonly number[]

      Coords, e.g. from VectorEntry or OperatorEntry

    • sizes: readonly number[]

      Dimensions sizes

    Returns void

    Error when not [0 <= c1 < s1, 0 <= c2 < s2, ...]

  • coordsFromIndex(index: number, sizes: number[]): number[]
  • coordsToIndex(coords: readonly number[], sizes: readonly number[]): number
  • hslToHex(hParam: number, sParam: number, lParam: number): string
  • indicesComplement(indices: readonly number[], n: number): number[]
  • Creates complement indices, sorted.

    Parameters

    • indices: readonly number[]

      E.g. [3, 1]

    • n: number

      E.g. 5

    Returns number[]

    E.g. [0, 2, 4]

  • isPermutation(array: number[], n?: number): boolean
  • Checks if a given array is a permuation, i.e. consist of [0, 1, 2, ..., n - 1] in any order.

    Parameters

    • array: number[]

      Array to be tested

    • n: number = array.length

      Number of elements

    Returns boolean

  • joinCoordsFunc(coordIndices: readonly number[], complementIndices: readonly number[]): (coordGroup: readonly number[], coordContraction: readonly number[]) => number[]
  • A function to merge coordinates.

    Parameters

    • coordIndices: readonly number[]

      E.g. [3, 1]

    • complementIndices: readonly number[]

      E.g. [0, 2, 4]

    Returns (coordGroup: readonly number[], coordContraction: readonly number[]) => number[]

    A function that for [2, 3, 5], [7, 11] -> [2, 11, 3, 7, 5]

      • (coordGroup: readonly number[], coordContraction: readonly number[]): number[]
      • Parameters

        • coordGroup: readonly number[]
        • coordContraction: readonly number[]

        Returns number[]

  • startingDirection(rotation: number): DirEnum
  • Output an enum describing laser starting polarization

    remark

    Moved from QG2

    Parameters

    • rotation: number

    Returns DirEnum

    a string enum

  • startingPolarization(polarization: number): PolEnum
  • Output an enum describing laser starting polarization

    remark

    Moved from QG2

    Parameters

    • polarization: number

    Returns PolEnum

    a string enum

  • weightedRandomInt(weights: number[], normalize?: boolean): number
  • Pick a random index of an array according to weights.

    Parameters

    • weights: number[]

      An array of weights. By default they should sum up to 1.

    • normalize: boolean = true

      If to normalize array.

    Returns number

    A number [0, ..., weights.length -1].

Generated using TypeDoc