Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Group

A Group is a subclass of Array. It should onnly contain Pt instances. You can think of it as an array of arrays (Float32Arrays to be specific). See Group guide for details

Hierarchy

Indexable

[n: number]: Pt

A Group is a subclass of Array. It should onnly contain Pt instances. You can think of it as an array of arrays (Float32Arrays to be specific). See Group guide for details

Index

Constructors

constructor

Properties

Protected _id

_id: string

Static Array

Array: ArrayConstructor

Static length

length: number

Gets or sets the length of the array. This is a number one higher than the highest element defined in an array.

Accessors

id

  • get id(): string
  • set id(s: string): void
  • Returns string

  • Parameters

    • s: string

    Returns void

p1

  • get p1(): Pt
  • The first Pt in this group

    Returns Pt

p2

  • get p2(): Pt
  • The second Pt in this group

    Returns Pt

p3

  • get p3(): Pt
  • The third Pt in this group

    Returns Pt

p4

  • get p4(): Pt
  • The forth Pt in this group

    Returns Pt

q1

  • get q1(): Pt
  • The last Pt in this group

    Returns Pt

q2

  • get q2(): Pt
  • The second-last Pt in this group

    Returns Pt

q3

  • get q3(): Pt
  • The third-last Pt in this group

    Returns Pt

q4

  • get q4(): Pt
  • The forth-last Pt in this group

    Returns Pt

Methods

$matrixAdd

  • Apply this group as a matrix and calculate matrix addition

    Parameters

    • g: GroupLike | number[][] | number

      a scalar number, an array of numeric arrays, or a group of Pt

    Returns Group

    a new Group

$matrixMultiply

  • $matrixMultiply(g: GroupLike | number, transposed?: boolean, elementwise?: boolean): Group
  • Apply this group as a matrix and calculate matrix multiplication

    Parameters

    • g: GroupLike | number

      a scalar number, an array of numeric arrays, or a Group of K Pts, each with N dimensions (K-rows, N-columns) -- or if transposed is true, then N Pts with K dimensions

    • Default value transposed: boolean = false

      (Only applicable if it's not elementwise multiplication) If true, then a and b's columns should match (ie, each Pt should have the same dimensions). Default is false.

    • Default value elementwise: boolean = false

      if true, then the multiplication is done element-wise. Default is false.

    Returns Group

    If not elementwise, this will return a new Group with M Pt, each with N dimensions (M-rows, N-columns).

$zip

  • $zip(defaultValue?: number | boolean, useLongest?: boolean): Group
  • Zip a group of Pt. eg, [[1,2],[3,4],[5,6]] => [[1,3,5],[2,4,6]]

    Parameters

    • Default value defaultValue: number | boolean = undefined

      a default value to fill if index out of bound. If not provided, it will throw an error instead.

    • Default value useLongest: boolean = false

      If true, find the longest list of values in a Pt and use its length for zipping. Default is false, which uses the first item's length for zipping.

    Returns Group

add

  • add(...args: any[]): this
  • Add scalar or vector values to this group's Pts.

    Parameters

    • Rest ...args: any[]

      a list of numbers, an array of number, or an object with {x,y,z,w} properties

    Returns this

anchorFrom

  • anchorFrom(ptOrIndex?: PtLike | number): void
  • Anchor all the Pts in this Group by its absolute position from a target Pt. (ie, add all Pt with the target anchor to get an absolute position). All the Pts' values will be updated.

    Parameters

    • Default value ptOrIndex: PtLike | number = 0

      a Pt, or a numeric index to target a specific Pt in this Group

    Returns void

anchorTo

  • anchorTo(ptOrIndex?: PtLike | number): void
  • Anchor all the Pts in this Group using a target Pt as origin. (ie, subtract all Pt with the target anchor to get a relative position). All the Pts' values will be updated.

    Parameters

    • Default value ptOrIndex: PtLike | number = 0

      a Pt, or a numeric index to target a specific Pt in this Group

    Returns void

boundingBox

  • Find the rectangular bounding box of this group's Pts.

    Returns Group

    a Group of 2 Pts representing the top-left and bottom-right of the rectangle

centroid

  • centroid(): Pt
  • Find the centroid of this group's Pts, which is the average middle point.

    Returns Pt

clone

  • Depp clone this group and its Pts

    Returns Group

divide

  • divide(...args: any[]): this
  • Divide this group's Pts over scalar or vector values (as element-wise)

    Parameters

    • Rest ...args: any[]

      a list of numbers, an array of number, or an object with {x,y,z,w} properties

    Returns this

forEachPt

  • forEachPt(ptFn: string, ...args: any[]): this
  • Update each Pt in this Group with a Pt function

    Parameters

    • ptFn: string

      string name of an existing Pt function. Note that the function must return Pt.

    • Rest ...args: any[]

      arguments for the function specified in ptFn

    Returns this

insert

  • insert(pts: GroupLike, index?: number): this
  • Insert a Pt into this group

    Parameters

    • pts: GroupLike

      Another group of Pts

    • Default value index: number = 0

      the index position to insert into

    Returns this

interpolate

  • interpolate(t: number): Pt
  • Get an interpolated point on the line segments defined by this Group

    Parameters

    • t: number

      a value between 0 to 1 usually

    Returns Pt

lines

  • Get all the line segments (ie, edges in a graph) of this group

    Returns Group[]

moveBy

  • moveBy(...args: any[]): this
  • Move every Pt's position by a specific amount. Same as add.

    Parameters

    • Rest ...args: any[]

      a list of numbers, an array of number, or an object with {x,y,z,w} properties

    Returns this

moveTo

  • moveTo(...args: any[]): this
  • Move the first Pt in this group to a specific position, and move all the other Pts correspondingly

    Parameters

    • Rest ...args: any[]

      a list of numbers, an array of number, or an object with {x,y,z,w} properties

    Returns this

multiply

  • multiply(...args: any[]): this
  • Multiply scalar or vector values (as element-wise) with this group's Pts.

    Parameters

    • Rest ...args: any[]

      a list of numbers, an array of number, or an object with {x,y,z,w} properties

    Returns this

op

  • op(fn: function): function
  • Create an operation using this Group, passing this Group into a custom function's first parameter. See the Op guide for details. For example: let myOp = group.op( fn ); let result = myOp( [1,2,3] );

    Parameters

    • fn: function

      any function that takes a Group as its first parameter

        • Parameters

          Returns any

    Returns function

    a resulting function that takes other parameters required in fn

      • (...rest: any[]): any
      • Parameters

        • Rest ...rest: any[]

        Returns any

ops

  • ops(fns: function[]): function[]
  • This combines a series of operations into an array. See op() for details. For example: let myOps = pt.ops([fn1, fn2, fn3]); let results = myOps.map( (op) => op([1,2,3]) );

    Parameters

    • fns: function[]

      an array of functions for op

    Returns function[]

    an array of resulting functions

reflect2D

  • reflect2D(line: GroupLike, axis?: string): this
  • Reflect this group's Pts along a 2D line. Default anchor point is the first Pt in this group.

    Parameters

    • line: GroupLike

      a Group of 2 Pts that defines a line for reflection

    • Optional axis: string

      optional axis such as "yz" to define a 2D plane of reflection

    Returns this

remove

  • remove(index?: number, count?: number): Group
  • Like Array's splice function, with support for negative index and a friendlier name.

    Parameters

    • Default value index: number = 0

      start index, which can be negative (where -1 is at index 0, -2 at index 1, etc)

    • Default value count: number = 1

      number of items to remove

    Returns Group

    The items that are removed.

rotate2D

  • rotate2D(angle: number, anchor?: PtLike, axis?: string): this
  • Rotate this group's Pt from an anchor point in 2D. Default anchor point is the first Pt in this group.

    Parameters

    • angle: number

      rotate angle

    • Optional anchor: PtLike

      optional anchor point to scale from

    • Optional axis: string

      optional string such as "yz" to specify a 2D plane

    Returns this

scale

  • scale(scale: number | number[] | PtLike, anchor?: PtLike): this
  • Scale this group's Pts from an anchor point. Default anchor point is the first Pt in this group.

    Parameters

    • scale: number | number[] | PtLike

      scale ratio

    • Optional anchor: PtLike

      optional anchor point to scale from

    Returns this

segments

  • segments(pts_per_segment?: number, stride?: number, loopBack?: boolean): Group[]
  • Split this group into an array of sub-group segments

    Parameters

    • Default value pts_per_segment: number = 2

      number of Pts in each segment

    • Default value stride: number = 1

      forward-step to take

    • Default value loopBack: boolean = false

      if true, always go through the array till the end and loop back to the beginning to complete the segments if needed

    Returns Group[]

shear2D

  • shear2D(scale: number | number[] | PtLike, anchor?: PtLike, axis?: string): this
  • Shear this group's Pt from an anchor point in 2D. Default anchor point is the first Pt in this group.

    Parameters

    • scale: number | number[] | PtLike
    • Optional anchor: PtLike

      optional anchor point to scale from

    • Optional axis: string

      optional string such as "yz" to specify a 2D plane

    Returns this

sortByDimension

  • sortByDimension(dim: number, desc?: boolean): this
  • Sort this group's Pts by values in a specific dimension

    Parameters

    • dim: number

      dimensional index

    • Default value desc: boolean = false

      if true, sort descending. Default is false (ascending)

    Returns this

split

  • split(chunkSize: number, stride?: number, loopBack?: boolean): Group[]
  • Split this Group into an array of sub-groups

    Parameters

    • chunkSize: number

      number of items per sub-group

    • Optional stride: number

      forward-steps after each sub-group

    • Default value loopBack: boolean = false

      if true, always go through the array till the end and loop back to the beginning to complete the segments if needed

    Returns Group[]

subtract

  • subtract(...args: any[]): this
  • Subtract scalar or vector values from this group's Pts.

    Parameters

    • Rest ...args: any[]

      a list of numbers, an array of number, or an object with {x,y,z,w} properties

    Returns this

toString

  • toString(): string
  • Get a string representation of this group

    Returns string

zipSlice

  • zipSlice(index: number, defaultValue?: number | boolean): Pt
  • Zip one slice of an array of Pt. Imagine the Pts are organized in rows, then this function will take the values in a specific column.

    Parameters

    • index: number
    • Default value defaultValue: number | boolean = false

      a default value to fill if index out of bound. If not provided, it will throw an error instead.

    Returns Pt

Static __@iterator

  • __@iterator(): IterableIterator<Pt>
  • Iterator

    Returns IterableIterator<Pt>

Static __@unscopables

  • __@unscopables(): object
  • Returns an object whose properties have the value 'true' when they will be absent when used in a 'with' statement.

    Returns object

    • copyWithin: boolean
    • entries: boolean
    • fill: boolean
    • find: boolean
    • findIndex: boolean
    • keys: boolean
    • values: boolean

Static concat

  • concat(...items: Pt[][]): Pt[]
  • concat(...items: (T[] | T)[]): Pt[]
  • Combines two or more arrays.

    Parameters

    • Rest ...items: Pt[][]

      Additional items to add to the end of array1.

    Returns Pt[]

  • Combines two or more arrays.

    Parameters

    • Rest ...items: (T[] | T)[]

      Additional items to add to the end of array1.

    Returns Pt[]

Static copyWithin

  • copyWithin(target: number, start: number, end?: number): this
  • Returns the this object after copying a section of the array identified by start and end to the same array starting at position target

    Parameters

    • target: number

      If target is negative, it is treated as length+target where length is the length of the array.

    • start: number

      If start is negative, it is treated as length+start. If end is negative, it is treated as length+end.

    • Optional end: number

      If not specified, length of the this object is used as its default value.

    Returns this

Static entries

  • entries(): IterableIterator<[number, Pt]>
  • Returns an array of key, value pairs for every entry in the array

    Returns IterableIterator<[number, Pt]>

Static every

  • every(callbackfn: function): boolean
  • every(callbackfn: function, thisArg: undefined): boolean
  • every<Z>(callbackfn: function, thisArg: Z): boolean
  • Determines whether all the members of an array satisfy the specified test.

    Parameters

    • callbackfn: function

      A function that accepts up to three arguments. The every method calls the callbackfn function for each element in array1 until the callbackfn returns false, or until the end of the array.

        • (this: void, value: Pt, index: number, array: Pt[]): boolean
        • Parameters

          • this: void
          • value: Pt
          • index: number
          • array: Pt[]

          Returns boolean

    Returns boolean

  • Parameters

    • callbackfn: function
        • (this: void, value: Pt, index: number, array: Pt[]): boolean
        • Parameters

          • this: void
          • value: Pt
          • index: number
          • array: Pt[]

          Returns boolean

    • thisArg: undefined

    Returns boolean

  • Type parameters

    • Z

    Parameters

    • callbackfn: function
        • (this: Z, value: Pt, index: number, array: Pt[]): boolean
        • Parameters

          • this: Z
          • value: Pt
          • index: number
          • array: Pt[]

          Returns boolean

    • thisArg: Z

    Returns boolean

Static fill

  • fill(value: Pt, start?: number, end?: number): this
  • Returns the this object after filling the section identified by start and end with value

    Parameters

    • value: Pt

      value to fill array section with

    • Optional start: number

      index to start filling the array at. If start is negative, it is treated as length+start where length is the length of the array.

    • Optional end: number

      index to stop filling the array at. If end is negative, it is treated as length+end.

    Returns this

Static filter

  • filter(callbackfn: function): Pt[]
  • filter(callbackfn: function, thisArg: undefined): Pt[]
  • filter<Z>(callbackfn: function, thisArg: Z): Pt[]
  • Returns the elements of an array that meet the condition specified in a callback function.

    Parameters

    • callbackfn: function

      A function that accepts up to three arguments. The filter method calls the callbackfn function one time for each element in the array.

        • (this: void, value: Pt, index: number, array: Pt[]): any
        • Parameters

          • this: void
          • value: Pt
          • index: number
          • array: Pt[]

          Returns any

    Returns Pt[]

  • Parameters

    • callbackfn: function
        • (this: void, value: Pt, index: number, array: Pt[]): any
        • Parameters

          • this: void
          • value: Pt
          • index: number
          • array: Pt[]

          Returns any

    • thisArg: undefined

    Returns Pt[]

  • Type parameters

    • Z

    Parameters

    • callbackfn: function
        • (this: Z, value: Pt, index: number, array: Pt[]): any
        • Parameters

          • this: Z
          • value: Pt
          • index: number
          • array: Pt[]

          Returns any

    • thisArg: Z

    Returns Pt[]

Static find

  • find(predicate: function): Pt | undefined
  • find(predicate: function, thisArg: undefined): Pt | undefined
  • find<Z>(predicate: function, thisArg: Z): Pt | undefined
  • Returns the value of the first element in the array where predicate is true, and undefined otherwise.

    Parameters

    • predicate: function

      find calls predicate once for each element of the array, in ascending order, until it finds one where predicate returns true. If such an element is found, find immediately returns that element value. Otherwise, find returns undefined.

        • (this: void, value: Pt, index: number, obj: Array<Pt>): boolean
        • Parameters

          • this: void
          • value: Pt
          • index: number
          • obj: Array<Pt>

          Returns boolean

    Returns Pt | undefined

  • Parameters

    • predicate: function
        • (this: void, value: Pt, index: number, obj: Array<Pt>): boolean
        • Parameters

          • this: void
          • value: Pt
          • index: number
          • obj: Array<Pt>

          Returns boolean

    • thisArg: undefined

    Returns Pt | undefined

  • Type parameters

    • Z

    Parameters

    • predicate: function
        • (this: Z, value: Pt, index: number, obj: Array<Pt>): boolean
        • Parameters

          • this: Z
          • value: Pt
          • index: number
          • obj: Array<Pt>

          Returns boolean

    • thisArg: Z

    Returns Pt | undefined

Static findIndex

  • findIndex(predicate: function): number
  • findIndex(predicate: function, thisArg: undefined): number
  • findIndex<Z>(predicate: function, thisArg: Z): number
  • Returns the index of the first element in the array where predicate is true, and -1 otherwise.

    Parameters

    • predicate: function

      find calls predicate once for each element of the array, in ascending order, until it finds one where predicate returns true. If such an element is found, findIndex immediately returns that element index. Otherwise, findIndex returns -1.

        • (this: void, value: Pt, index: number, obj: Array<Pt>): boolean
        • Parameters

          • this: void
          • value: Pt
          • index: number
          • obj: Array<Pt>

          Returns boolean

    Returns number

  • Parameters

    • predicate: function
        • (this: void, value: Pt, index: number, obj: Array<Pt>): boolean
        • Parameters

          • this: void
          • value: Pt
          • index: number
          • obj: Array<Pt>

          Returns boolean

    • thisArg: undefined

    Returns number

  • Type parameters

    • Z

    Parameters

    • predicate: function
        • (this: Z, value: Pt, index: number, obj: Array<Pt>): boolean
        • Parameters

          • this: Z
          • value: Pt
          • index: number
          • obj: Array<Pt>

          Returns boolean

    • thisArg: Z

    Returns number

Static forEach

  • forEach(callbackfn: function): void
  • forEach(callbackfn: function, thisArg: undefined): void
  • forEach<Z>(callbackfn: function, thisArg: Z): void
  • Performs the specified action for each element in an array.

    Parameters

    • callbackfn: function

      A function that accepts up to three arguments. forEach calls the callbackfn function one time for each element in the array.

        • (this: void, value: Pt, index: number, array: Pt[]): void
        • Parameters

          • this: void
          • value: Pt
          • index: number
          • array: Pt[]

          Returns void

    Returns void

  • Parameters

    • callbackfn: function
        • (this: void, value: Pt, index: number, array: Pt[]): void
        • Parameters

          • this: void
          • value: Pt
          • index: number
          • array: Pt[]

          Returns void

    • thisArg: undefined

    Returns void

  • Type parameters

    • Z

    Parameters

    • callbackfn: function
        • (this: Z, value: Pt, index: number, array: Pt[]): void
        • Parameters

          • this: Z
          • value: Pt
          • index: number
          • array: Pt[]

          Returns void

    • thisArg: Z

    Returns void

Static fromArray

  • Convert an array of numeric arrays into a Group of Pts

    example

    Group.fromArray( [[1,2], [3,4], [5,6]] )

    Parameters

    • list: PtLike[]

      an array of numeric arrays

    Returns Group

Static fromPtArray

  • Convert an array of Pts into a Group.

    Parameters

    Returns Group

Static indexOf

  • indexOf(searchElement: Pt, fromIndex?: number): number
  • Returns the index of the first occurrence of a value in an array.

    Parameters

    • searchElement: Pt

      The value to locate in the array.

    • Optional fromIndex: number

      The array index at which to begin the search. If fromIndex is omitted, the search starts at index 0.

    Returns number

Static join

  • join(separator?: string): string
  • Adds all the elements of an array separated by the specified separator string.

    Parameters

    • Optional separator: string

      A string used to separate one element of an array from the next in the resulting String. If omitted, the array elements are separated with a comma.

    Returns string

Static keys

  • keys(): IterableIterator<number>
  • Returns an list of keys in the array

    Returns IterableIterator<number>

Static lastIndexOf

  • lastIndexOf(searchElement: Pt, fromIndex?: number): number
  • Returns the index of the last occurrence of a specified value in an array.

    Parameters

    • searchElement: Pt

      The value to locate in the array.

    • Optional fromIndex: number

      The array index at which to begin the search. If fromIndex is omitted, the search starts at the last index in the array.

    Returns number

Static map

  • map<U>(this: [Pt, Pt, Pt, Pt, Pt], callbackfn: function): [U, U, U, U, U]
  • map<U>(this: [Pt, Pt, Pt, Pt, Pt], callbackfn: function, thisArg: undefined): [U, U, U, U, U]
  • map<Z, U>(this: [Pt, Pt, Pt, Pt, Pt], callbackfn: function, thisArg: Z): [U, U, U, U, U]
  • map<U>(this: [Pt, Pt, Pt, Pt], callbackfn: function): [U, U, U, U]
  • map<U>(this: [Pt, Pt, Pt, Pt], callbackfn: function, thisArg: undefined): [U, U, U, U]
  • map<Z, U>(this: [Pt, Pt, Pt, Pt], callbackfn: function, thisArg: Z): [U, U, U, U]
  • map<U>(this: [Pt, Pt, Pt], callbackfn: function): [U, U, U]
  • map<U>(this: [Pt, Pt, Pt], callbackfn: function, thisArg: undefined): [U, U, U]
  • map<Z, U>(this: [Pt, Pt, Pt], callbackfn: function, thisArg: Z): [U, U, U]
  • map<U>(this: [Pt, Pt], callbackfn: function): [U, U]
  • map<U>(this: [Pt, Pt], callbackfn: function, thisArg: undefined): [U, U]
  • map<Z, U>(this: [Pt, Pt], callbackfn: function, thisArg: Z): [U, U]
  • map<U>(callbackfn: function): U[]
  • map<U>(callbackfn: function, thisArg: undefined): U[]
  • map<Z, U>(callbackfn: function, thisArg: Z): U[]
  • Calls a defined callback function on each element of an array, and returns an array that contains the results.

    Type parameters

    • U

    Parameters

    • this: [Pt, Pt, Pt, Pt, Pt]
    • callbackfn: function

      A function that accepts up to three arguments. The map method calls the callbackfn function one time for each element in the array.

        • (this: void, value: Pt, index: number, array: Pt[]): U
        • Parameters

          • this: void
          • value: Pt
          • index: number
          • array: Pt[]

          Returns U

    Returns [U, U, U, U, U]

  • Type parameters

    • U

    Parameters

    • this: [Pt, Pt, Pt, Pt, Pt]
    • callbackfn: function
        • (this: void, value: Pt, index: number, array: Pt[]): U
        • Parameters

          • this: void
          • value: Pt
          • index: number
          • array: Pt[]

          Returns U

    • thisArg: undefined

    Returns [U, U, U, U, U]

  • Type parameters

    • Z

    • U

    Parameters

    • this: [Pt, Pt, Pt, Pt, Pt]
    • callbackfn: function
        • (this: Z, value: Pt, index: number, array: Pt[]): U
        • Parameters

          • this: Z
          • value: Pt
          • index: number
          • array: Pt[]

          Returns U

    • thisArg: Z

    Returns [U, U, U, U, U]

  • Calls a defined callback function on each element of an array, and returns an array that contains the results.

    Type parameters

    • U

    Parameters

    • this: [Pt, Pt, Pt, Pt]
    • callbackfn: function

      A function that accepts up to three arguments. The map method calls the callbackfn function one time for each element in the array.

        • (this: void, value: Pt, index: number, array: Pt[]): U
        • Parameters

          • this: void
          • value: Pt
          • index: number
          • array: Pt[]

          Returns U

    Returns [U, U, U, U]

  • Type parameters

    • U

    Parameters

    • this: [Pt, Pt, Pt, Pt]
    • callbackfn: function
        • (this: void, value: Pt, index: number, array: Pt[]): U
        • Parameters

          • this: void
          • value: Pt
          • index: number
          • array: Pt[]

          Returns U

    • thisArg: undefined

    Returns [U, U, U, U]

  • Type parameters

    • Z

    • U

    Parameters

    • this: [Pt, Pt, Pt, Pt]
    • callbackfn: function
        • (this: Z, value: Pt, index: number, array: Pt[]): U
        • Parameters

          • this: Z
          • value: Pt
          • index: number
          • array: Pt[]

          Returns U

    • thisArg: Z

    Returns [U, U, U, U]

  • Calls a defined callback function on each element of an array, and returns an array that contains the results.

    Type parameters

    • U

    Parameters

    • this: [Pt, Pt, Pt]
    • callbackfn: function

      A function that accepts up to three arguments. The map method calls the callbackfn function one time for each element in the array.

        • (this: void, value: Pt, index: number, array: Pt[]): U
        • Parameters

          • this: void
          • value: Pt
          • index: number
          • array: Pt[]

          Returns U

    Returns [U, U, U]

  • Type parameters

    • U

    Parameters

    • this: [Pt, Pt, Pt]
    • callbackfn: function
        • (this: void, value: Pt, index: number, array: Pt[]): U
        • Parameters

          • this: void
          • value: Pt
          • index: number
          • array: Pt[]

          Returns U

    • thisArg: undefined

    Returns [U, U, U]

  • Type parameters

    • Z

    • U

    Parameters

    • this: [Pt, Pt, Pt]
    • callbackfn: function
        • (this: Z, value: Pt, index: number, array: Pt[]): U
        • Parameters

          • this: Z
          • value: Pt
          • index: number
          • array: Pt[]

          Returns U

    • thisArg: Z

    Returns [U, U, U]

  • Calls a defined callback function on each element of an array, and returns an array that contains the results.

    Type parameters

    • U

    Parameters

    • this: [Pt, Pt]
    • callbackfn: function

      A function that accepts up to three arguments. The map method calls the callbackfn function one time for each element in the array.

        • (this: void, value: Pt, index: number, array: Pt[]): U
        • Parameters

          • this: void
          • value: Pt
          • index: number
          • array: Pt[]

          Returns U

    Returns [U, U]

  • Type parameters

    • U

    Parameters

    • this: [Pt, Pt]
    • callbackfn: function
        • (this: void, value: Pt, index: number, array: Pt[]): U
        • Parameters

          • this: void
          • value: Pt
          • index: number
          • array: Pt[]

          Returns U

    • thisArg: undefined

    Returns [U, U]

  • Type parameters

    • Z

    • U

    Parameters

    • this: [Pt, Pt]
    • callbackfn: function
        • (this: Z, value: Pt, index: number, array: Pt[]): U
        • Parameters

          • this: Z
          • value: Pt
          • index: number
          • array: Pt[]

          Returns U

    • thisArg: Z

    Returns [U, U]

  • Calls a defined callback function on each element of an array, and returns an array that contains the results.

    Type parameters

    • U

    Parameters

    • callbackfn: function

      A function that accepts up to three arguments. The map method calls the callbackfn function one time for each element in the array.

        • (this: void, value: Pt, index: number, array: Pt[]): U
        • Parameters

          • this: void
          • value: Pt
          • index: number
          • array: Pt[]

          Returns U

    Returns U[]

  • Type parameters

    • U

    Parameters

    • callbackfn: function
        • (this: void, value: Pt, index: number, array: Pt[]): U
        • Parameters

          • this: void
          • value: Pt
          • index: number
          • array: Pt[]

          Returns U

    • thisArg: undefined

    Returns U[]

  • Type parameters

    • Z

    • U

    Parameters

    • callbackfn: function
        • (this: Z, value: Pt, index: number, array: Pt[]): U
        • Parameters

          • this: Z
          • value: Pt
          • index: number
          • array: Pt[]

          Returns U

    • thisArg: Z

    Returns U[]

Static pop

  • pop(): Pt | undefined
  • Removes the last element from an array and returns it.

    Returns Pt | undefined

Static push

  • push(...items: Pt[]): number
  • Appends new elements to an array, and returns the new length of the array.

    Parameters

    • Rest ...items: Pt[]

      New elements of the Array.

    Returns number

Static reduce

  • reduce(callbackfn: function, initialValue?: Pt): Pt
  • reduce<U>(callbackfn: function, initialValue: U): U
  • Calls the specified callback function for all the elements in an array. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function.

    Parameters

    • callbackfn: function

      A function that accepts up to four arguments. The reduce method calls the callbackfn function one time for each element in the array.

        • (previousValue: Pt, currentValue: Pt, currentIndex: number, array: Pt[]): Pt
        • Parameters

          • previousValue: Pt
          • currentValue: Pt
          • currentIndex: number
          • array: Pt[]

          Returns Pt

    • Optional initialValue: Pt

      If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value.

    Returns Pt

  • Calls the specified callback function for all the elements in an array. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function.

    Type parameters

    • U

    Parameters

    • callbackfn: function

      A function that accepts up to four arguments. The reduce method calls the callbackfn function one time for each element in the array.

        • (previousValue: U, currentValue: Pt, currentIndex: number, array: Pt[]): U
        • Parameters

          • previousValue: U
          • currentValue: Pt
          • currentIndex: number
          • array: Pt[]

          Returns U

    • initialValue: U

      If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value.

    Returns U

Static reduceRight

  • reduceRight(callbackfn: function, initialValue?: Pt): Pt
  • reduceRight<U>(callbackfn: function, initialValue: U): U
  • Calls the specified callback function for all the elements in an array, in descending order. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function.

    Parameters

    • callbackfn: function

      A function that accepts up to four arguments. The reduceRight method calls the callbackfn function one time for each element in the array.

        • (previousValue: Pt, currentValue: Pt, currentIndex: number, array: Pt[]): Pt
        • Parameters

          • previousValue: Pt
          • currentValue: Pt
          • currentIndex: number
          • array: Pt[]

          Returns Pt

    • Optional initialValue: Pt

      If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value.

    Returns Pt

  • Calls the specified callback function for all the elements in an array, in descending order. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function.

    Type parameters

    • U

    Parameters

    • callbackfn: function

      A function that accepts up to four arguments. The reduceRight method calls the callbackfn function one time for each element in the array.

        • (previousValue: U, currentValue: Pt, currentIndex: number, array: Pt[]): U
        • Parameters

          • previousValue: U
          • currentValue: Pt
          • currentIndex: number
          • array: Pt[]

          Returns U

    • initialValue: U

      If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value.

    Returns U

Static reverse

  • reverse(): Pt[]
  • Reverses the elements in an Array.

    Returns Pt[]

Static shift

  • shift(): Pt | undefined
  • Removes the first element from an array and returns it.

    Returns Pt | undefined

Static slice

  • slice(start?: number, end?: number): Pt[]
  • Returns a section of an array.

    Parameters

    • Optional start: number

      The beginning of the specified portion of the array.

    • Optional end: number

      The end of the specified portion of the array.

    Returns Pt[]

Static some

  • some(callbackfn: function): boolean
  • some(callbackfn: function, thisArg: undefined): boolean
  • some<Z>(callbackfn: function, thisArg: Z): boolean
  • Determines whether the specified callback function returns true for any element of an array.

    Parameters

    • callbackfn: function

      A function that accepts up to three arguments. The some method calls the callbackfn function for each element in array1 until the callbackfn returns true, or until the end of the array.

        • (this: void, value: Pt, index: number, array: Pt[]): boolean
        • Parameters

          • this: void
          • value: Pt
          • index: number
          • array: Pt[]

          Returns boolean

    Returns boolean

  • Parameters

    • callbackfn: function
        • (this: void, value: Pt, index: number, array: Pt[]): boolean
        • Parameters

          • this: void
          • value: Pt
          • index: number
          • array: Pt[]

          Returns boolean

    • thisArg: undefined

    Returns boolean

  • Type parameters

    • Z

    Parameters

    • callbackfn: function
        • (this: Z, value: Pt, index: number, array: Pt[]): boolean
        • Parameters

          • this: Z
          • value: Pt
          • index: number
          • array: Pt[]

          Returns boolean

    • thisArg: Z

    Returns boolean

Static sort

  • sort(compareFn?: function): this
  • Sorts an array.

    Parameters

    • Optional compareFn: function

      The name of the function used to determine the order of the elements. If omitted, the elements are sorted in ascending, ASCII character order.

        • (a: Pt, b: Pt): number
        • Parameters

          Returns number

    Returns this

Static splice

  • splice(start: number, deleteCount?: number): Pt[]
  • splice(start: number, deleteCount: number, ...items: Pt[]): Pt[]
  • Removes elements from an array and, if necessary, inserts new elements in their place, returning the deleted elements.

    Parameters

    • start: number

      The zero-based location in the array from which to start removing elements.

    • Optional deleteCount: number

      The number of elements to remove.

    Returns Pt[]

  • Removes elements from an array and, if necessary, inserts new elements in their place, returning the deleted elements.

    Parameters

    • start: number

      The zero-based location in the array from which to start removing elements.

    • deleteCount: number

      The number of elements to remove.

    • Rest ...items: Pt[]

      Elements to insert into the array in place of the deleted elements.

    Returns Pt[]

Static toLocaleString

  • toLocaleString(): string
  • Returns string

Static toString

  • toString(): string
  • Returns a string representation of an array.

    Returns string

Static unshift

  • unshift(...items: Pt[]): number
  • Inserts new elements at the start of an array.

    Parameters

    • Rest ...items: Pt[]

      Elements to insert at the start of the Array.

    Returns number

Static values

  • values(): IterableIterator<Pt>
  • Returns an list of values in the array

    Returns IterableIterator<Pt>

Generated using TypeDoc