API (v2.0.0) - Giro3D
    Preparing search index...

    Class VectorArray<V, Buffer>Abstract

    A typed array of three.js Vectors.

    Type Parameters

    • V extends Vector = Vector

      The underlying Vector type.

    • Buffer extends TypedArray = TypedArray

      The underlying TypedArray type.

    Hierarchy (View Summary)

    Index

    Constructors

    Properties

    _array: Buffer

    Accessors

    Methods

    • Copies an element from one location to another in the array.

      Parameters

      • from: number
      • to: number

      Returns void

    • Allocates a new underlying array to match the new size, then copy the content of the previous array at the beginning of the new array.

      Parameters

      • newSize: number

        The new size, in number of vectors.

      Returns this

    • Performs the specified action for each element in an array.

      Note that mutating the callback value will not mutate the underlying array. To mutate the underlying array, use the index provided as second argument, then mutate the array with a mutating method, such as setVector:

      const array = new Vector3Array(...);

      // Add one to each Y value of the array
      array.forEach((v, index) => {
      // This has no effect on the Vector3Array:
      v.setY(v.y + 1);

      // Use this pattern instead:
      array.setVector(index, new Vector3(v.x, v.y + 1, v.z));

      // Or this one
      array.setY(index, v.y + 1);
      })

      Parameters

      • callbackfn: (value: Readonly<V>, index: number, array: this) => void

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

      Returns void

    • Gets the vector at the specified index.

      Parameters

      • index: number
      • Optionaltarget: V

      Returns V

    • Gets the fourth component of the vector at the specified index, or null if the dimension of this array is less than 4.

      Parameters

      • index: number

      Returns number | null

    • Gets the first component of the vector at the specified index.

      Parameters

      • index: number

      Returns number

    • Gets the second component of the vector at the specified index.

      Parameters

      • index: number

      Returns number

    • Gets the third component of the vector at the specified index, or null if the dimension of this array is less than 3.

      Parameters

      • index: number

      Returns number | null

    • Pushes a vector at the end of the array, allocating memory if necessary.

      Parameters

      • x: number
      • y: number
      • Optionalz: number
      • Optionalw: number

      Returns void

    • Pushes a vector at the end of the array, allocating memory if necessary.

      Parameters

      Returns void

    • Sets the component of the array at the specified index.

      Parameters

      • index: number
      • x: number
      • y: number
      • Optionalz: number
      • Optionalw: number

      Returns void

    • Sets the vector at the specified index.

      Parameters

      • index: number
      • v: V

      Returns void

    • Parameters

      • index: number
      • value: number

      Returns void

    • Parameters

      • index: number
      • value: number

      Returns void

    • Parameters

      • index: number
      • value: number

      Returns void

    • Parameters

      • index: number
      • value: number

      Returns void

    • Returns the Float32Array equivalent of this vector array. Note: if the underlying array is already a Float32Array, this array is returned. Otherwise, a new array is constructed.

      Returns Float32Array