Class: VecArray

VecArray

A base class for all vector arrays, gathering methods that share the same implementation in all array subclasses.

new VecArray()

Methods


add(b, c)

Adds vectors from the two argument arrays, storing the result in this array.
Parameters:
Name Type Description
b VecArray Array of first terms. Its length must be identical to this array's length.
c VecArray Array of second terms. Its length must be identical to this array's length.
Returns:
this
Type
VecArray

addAll(b, c)

Adds a vector to all argument array elements, storing the result in this array.
Parameters:
Name Type Description
b VecArray Array of first operands. Same length as this.
c Vec Second operand.
Returns:
this
Type
VecArray

addScaled(b, c, dt)

Adds vectors from the two argument arrays, scaling the second arguments, storing the result in this array.
Parameters:
Name Type Description
b VecArray Array of first terms. Its length must be identical to this array's length.
c VecArray Array of second terms. Its length must be identical to this array's length.
dt Number Single scalar scaling factor.
Returns:
this
Type
VecArray

clamp()

Constrains values in the array to the [0,1) interval.
Returns:
this
Type
VecArray

div(b, c)

Divides, elementwise, vectors from the two argument arrays, storing the result in this array.
Parameters:
Name Type Description
b VecArray Array of dividends.
c VecArray Array of divisors.
Returns:
this
Type
VecArray

divAll(b, c)

Divides (elementwise) all argument array elements with a vector, storing the result in this array.
Parameters:
Name Type Description
b VecArray Array of first operands. Same length as this.
c Vec Second operand.
Returns:
this
Type
VecArray

divWithVec1s(b, c)

Divides, elementwise, vectors from the two argument arrays, repeating individual values of the second one to produce the same number of values as in the output array.
Parameters:
Name Type Description
b VecArray Array of dividends. Its length must be identical to this array's length.
c Vec1Array Array of divisors. Its length must be identical to this array's length.
Returns:
this
Type
VecArray

exp(b, c)

Exponentiates vectors from an array with a scalar, storing the result in this array. For scaling with factors stored in an array, see mulAll.
Parameters:
Name Type Description
b VecArray Array of vectors to scale. Its length must be identical to this array's length.
c VecArray Exponent.
Returns:
this
Type
VecArray

mul(b, c)

Multipies, elementwise, vectors from the two argument arrays, storing the result in this array.
Parameters:
Name Type Description
b VecArray Array of factors. Its length must be identical to this array's length.
c VecArray Array of factors. Its length must be identical to this array's length.
Returns:
this
Type
VecArray

mulAll(b, c)

Multiplies (elementwise) a vector with all argument array elements, storing the result in this array.
Parameters:
Name Type Description
b VecArray Array of first operands. Same length as this.
c Vec Second operand.
Returns:
this
Type
VecArray

mulWithVec1s(b, c)

Multipies, elementwise, vectors from the two argument arrays, repeating individual values of the second one to produce the same number of elements as in the output array. For scaling with a single scalar factor, see scale.
Parameters:
Name Type Description
b VecArray Array of factors. Its length must be identical to this array's length.
c Vec1Array Array of factors. Its length must be identical to this array's length.
Returns:
this
Type
VecArray

random()

Fills the array with random values between 0 and 1.
Returns:
this
Type
VecArray

scale(b, c)

Multipies vectors from an array with a scalar, storing the result in this array. For scaling with factors stored in an array, see mulAll.
Parameters:
Name Type Description
b VecArray Array of vectors to scale. Its length must be identical to this array's length.
c VecArray Scale factor.
Returns:
this
Type
VecArray

set(data)

Sets the value of the vector array from another WebGLMath vector, vector array, matrix, or matrix array object, or an array of numbers.
Parameters:
Name Type Description
data Array.<number> | Object Input data.

sub(b, c)

Subtracts vectors from the two argument arrays, storing the result in this array.
Parameters:
Name Type Description
b VecArray Array of minuends. Its length must be identical to this array's length.
c VecArray Array of subtrahends. Its length must be identical to this array's length.
Returns:
this
Type
VecArray

subAll(b, c)

Subtracts a vector from all argument array elements, storing the result in this array.
Parameters:
Name Type Description
b VecArray Array of first operands. Same length as this.
c Vec Second operand.
Returns:
this
Type
VecArray