Variable Utilities

Utilities: {
    calculateAverage: ((arr) => number);
    calculateDistance: ((p1, p2) => number);
    calculateSquaredDistance: ((p1, p2) => number);
    getRandomSubset: ((arr, n) => any[]);
    getRandomSubset_map: ((map, n) => Map<any, any>);
}

Type declaration

  • calculateAverage: ((arr) => number)
      • (arr): number
      • calculate the average of an array of numberss

        Parameters

        • arr: number[]

          an array of number whose average has to be calculated

        Returns number

        the average

  • calculateDistance: ((p1, p2) => number)
      • (p1, p2): number
      • Calculate the distance betweeen two points

        Parameters

        • p1: Point

          the first point

        • p2: Point

          the second point

        Returns number

        the distance between the points

  • calculateSquaredDistance: ((p1, p2) => number)
      • (p1, p2): number
      • Calculate the squared distance between two points

        Parameters

        • p1: Point

          the first point

        • p2: Point

          the second point

        Returns number

        the squared distance between the two points

  • getRandomSubset: ((arr, n) => any[])
      • (arr, n): any[]
      • get a random subset of something from a array of things must provide the number of things we want from that array

        Parameters

        • arr: any[]

          the array from which the subset has to be made

        • n: number

          number of items to select

        Returns any[]

        a new array made up of a random sample from the original array

  • getRandomSubset_map: ((map, n) => Map<any, any>)
      • (map, n): Map<any, any>
      • This is a super useful method to get a random number of edges or something that you would like to draw this is primarily done because there are way too many edges sometimes and and the number of edges is really What slows the whole rendering process down

        Parameters

        • map: Map<number, any>

          the map that youd like to reduce

        • n: number

          the fraction of items that youd like to return from this map

        Returns Map<any, any>

        A reduced map with a fractio of those many entries

Generated using TypeDoc