vec4

vec4()

4 Dimensional Vector

Methods

inneradd$5(out, a, b)vec4

Adds two vec4's
Name Type Description
out vec4 the receiving vector
a vec4 the first operand
b vec4 the second operand
Returns:
out

innerceil$1(out, a)vec4

Math.ceil the components of a vec4
Name Type Description
out vec4 the receiving vector
a vec4 vector to ceil
Returns:
out

innerclone$5(a)vec4

Creates a new vec4 initialized with values from an existing vector
Name Type Description
a vec4 vector to clone
Returns:
a new 4D vector

innercopy$5(out, a)vec4

Copy the values from one vec4 to another
Name Type Description
out vec4 the receiving vector
a vec4 the source vector
Returns:
out

innercreate$5()vec4

Creates a new, empty vec4
Returns:
a new 4D vector

innercross$1(result, U, V, W)vec4

Returns the cross-product of three vectors in a 4-dimensional space
Name Type Description
result vec4 the receiving vector
U vec4 the first vector
V vec4 the second vector
W vec4 the third vector
Returns:
result

innerdist$1()

Alias for vec4.distance

innerdistance$1(a, b)Number

Calculates the euclidian distance between two vec4's
Name Type Description
a vec4 the first operand
b vec4 the second operand
Returns:
distance between a and b

innerdiv$1()

Alias for vec4.divide

innerdivide$1(out, a, b)vec4

Divides two vec4's
Name Type Description
out vec4 the receiving vector
a vec4 the first operand
b vec4 the second operand
Returns:
out

innerdot$1(a, b)Number

Calculates the dot product of two vec4's
Name Type Description
a vec4 the first operand
b vec4 the second operand
Returns:
dot product of a and b

innerequals$6(a, b)Boolean

Returns whether or not the vectors have approximately the same elements in the same position.
Name Type Description
a vec4 The first vector.
b vec4 The second vector.
Returns:
True if the vectors are equal, false otherwise.

innerexactEquals$5(a, b)Boolean

Returns whether or not the vectors have exactly the same elements in the same position (when compared with ===)
Name Type Description
a vec4 The first vector.
b vec4 The second vector.
Returns:
True if the vectors are equal, false otherwise.

innerfloor$1(out, a)vec4

Math.floor the components of a vec4
Name Type Description
out vec4 the receiving vector
a vec4 vector to floor
Returns:
out

innerforEach$1(a, stride, offset, count, fn, arg)Array

Perform some operation over an array of vec4s.
Name Type Description
a Array the array of vectors to iterate over
stride Number Number of elements between the start of each vec4. If 0 assumes tightly packed
offset Number Number of elements to skip at the beginning of the array
count Number Number of vec4s to iterate over. If 0 iterates over entire array
fn function Function to call for each vector in the array
arg Object optional additional argument to pass to fn
Returns:
a

innerfromValues$5(x, y, z, w)vec4

Creates a new vec4 initialized with the given values
Name Type Description
x Number X component
y Number Y component
z Number Z component
w Number W component
Returns:
a new 4D vector

innerinverse$1(out, a)vec4

Returns the inverse of the components of a vec4
Name Type Description
out vec4 the receiving vector
a vec4 vector to invert
Returns:
out

innerlen$1()

Alias for vec4.length

innerlength$1(a)Number

Calculates the length of a vec4
Name Type Description
a vec4 vector to calculate length of
Returns:
length of a

innerlerp$1(out, a, b, t)vec4

Performs a linear interpolation between two vec4's
Name Type Description
out vec4 the receiving vector
a vec4 the first operand
b vec4 the second operand
t Number interpolation amount, in the range [0-1], between the two inputs
Returns:
out

innermax$1(out, a, b)vec4

Returns the maximum of two vec4's
Name Type Description
out vec4 the receiving vector
a vec4 the first operand
b vec4 the second operand
Returns:
out

innermin$1(out, a, b)vec4

Returns the minimum of two vec4's
Name Type Description
out vec4 the receiving vector
a vec4 the first operand
b vec4 the second operand
Returns:
out

innermul$5()

Alias for vec4.multiply

innermultiply$5(out, a, b)vec4

Multiplies two vec4's
Name Type Description
out vec4 the receiving vector
a vec4 the first operand
b vec4 the second operand
Returns:
out

innernegate$1(out, a)vec4

Negates the components of a vec4
Name Type Description
out vec4 the receiving vector
a vec4 vector to negate
Returns:
out

innernormalize$1(out, a)vec4

Normalize a vec4
Name Type Description
out vec4 the receiving vector
a vec4 vector to normalize
Returns:
out

innerrandom$1(out, scale)vec4

Generates a random vector with the given scale
Name Type Description
out vec4 the receiving vector
scale Number optional Length of the resulting vector. If ommitted, a unit vector will be returned
Returns:
out

innerround$1(out, a)vec4

Math.round the components of a vec4
Name Type Description
out vec4 the receiving vector
a vec4 vector to round
Returns:
out

innerscale$5(out, a, b)vec4

Scales a vec4 by a scalar number
Name Type Description
out vec4 the receiving vector
a vec4 the vector to scale
b Number amount to scale the vector by
Returns:
out

innerscaleAndAdd$1(out, a, b, scale)vec4

Adds two vec4's after scaling the second operand by a scalar value
Name Type Description
out vec4 the receiving vector
a vec4 the first operand
b vec4 the second operand
scale Number the amount to scale b by before adding
Returns:
out

innerset$5(out, x, y, z, w)vec4

Set the components of a vec4 to the given values
Name Type Description
out vec4 the receiving vector
x Number X component
y Number Y component
z Number Z component
w Number W component
Returns:
out

innersqrDist$1()

Alias for vec4.squaredDistance

innersqrLen$1()

Alias for vec4.squaredLength

innersquaredDistance$1(a, b)Number

Calculates the squared euclidian distance between two vec4's
Name Type Description
a vec4 the first operand
b vec4 the second operand
Returns:
squared distance between a and b

innersquaredLength$1(a)Number

Calculates the squared length of a vec4
Name Type Description
a vec4 vector to calculate squared length of
Returns:
squared length of a

innerstr$5(a)String

Returns a string representation of a vector
Name Type Description
a vec4 vector to represent as a string
Returns:
string representation of the vector

innersub$5()

Alias for vec4.subtract

innersubtract$5(out, a, b)vec4

Subtracts vector b from vector a
Name Type Description
out vec4 the receiving vector
a vec4 the first operand
b vec4 the second operand
Returns:
out

innertransformMat4$1(out, a, m)vec4

Transforms the vec4 with a mat4.
Name Type Description
out vec4 the receiving vector
a vec4 the vector to transform
m mat4 matrix to transform with
Returns:
out

innertransformQuat$1(out, a, q)vec4

Transforms the vec4 with a quat
Name Type Description
out vec4 the receiving vector
a vec4 the vector to transform
q quat quaternion to transform with
Returns:
out

innerzero$1(out)vec4

Set the components of a vec4 to zero
Name Type Description
out vec4 the receiving vector
Returns:
out