Options
All
• Public
• Public/Protected
• All

Namespace vec4

Functions

• Adds two vec4's

Parameters

• out: vec4

the receiving vector

the first operand

the second operand

out

ceil

• ceil(out: vec4, a: ReadonlyVec4): vec4
• Math.ceil the components of a vec4

Parameters

• out: vec4

the receiving vector

vector to ceil

out

clone

• clone(a: ReadonlyVec4): vec4
• Creates a new vec4 initialized with values from an existing vector

Parameters

vector to clone

Returns vec4

a new 4D vector

copy

• copy(out: vec4, a: ReadonlyVec4): vec4
• Copy the values from one vec4 to another

Parameters

• out: vec4

the receiving vector

the source vector

out

create

• Creates a new, empty vec4

Returns vec4

a new 4D vector

cross

• cross(out: any, u: any, v: any, w: any): vec4
• Returns the cross-product of three vectors in a 4-dimensional space

result

dist

• Calculates the euclidian distance between two vec4's

Parameters

the first operand

the second operand

Returns number

distance between a and b

distance

• Calculates the euclidian distance between two vec4's

Parameters

the first operand

the second operand

Returns number

distance between a and b

div

• div(out: vec4, a: ReadonlyVec4, b: ReadonlyVec4): vec4
• Divides two vec4's

Parameters

• out: vec4

the receiving vector

the first operand

the second operand

out

divide

• divide(out: vec4, a: ReadonlyVec4, b: ReadonlyVec4): vec4
• Divides two vec4's

Parameters

• out: vec4

the receiving vector

the first operand

the second operand

out

dot

• Calculates the dot product of two vec4's

Parameters

the first operand

the second operand

Returns number

dot product of a and b

equals

• Returns whether or not the vectors have approximately the same elements in the same position.

Parameters

The first vector.

The second vector.

Returns boolean

True if the vectors are equal, false otherwise.

exactEquals

• Returns whether or not the vectors have exactly the same elements in the same position (when compared with ===)

Parameters

The first vector.

The second vector.

Returns boolean

True if the vectors are equal, false otherwise.

floor

• floor(out: vec4, a: ReadonlyVec4): vec4
• Math.floor the components of a vec4

Parameters

• out: vec4

the receiving vector

vector to floor

out

forEach

• forEach(a: any, stride: any, offset: any, count: any, fn: any, arg: any): any

fromValues

• fromValues(x: number, y: number, z: number, w: number): vec4
• Creates a new vec4 initialized with the given values

Parameters

• x: number

X component

• y: number

Y component

• z: number

Z component

• w: number

W component

Returns vec4

a new 4D vector

inverse

• inverse(out: vec4, a: ReadonlyVec4): vec4
• Returns the inverse of the components of a vec4

Parameters

• out: vec4

the receiving vector

vector to invert

out

len

• len(a: ReadonlyVec4): number
• Calculates the length of a vec4

Parameters

vector to calculate length of

length of a

length

• length(a: ReadonlyVec4): number
• Calculates the length of a vec4

Parameters

vector to calculate length of

length of a

lerp

• lerp(out: vec4, a: ReadonlyVec4, b: ReadonlyVec4, t: number): vec4
• Performs a linear interpolation between two vec4's

Parameters

• out: vec4

the receiving vector

the first operand

the second operand

• t: number

interpolation amount, in the range [0-1], between the two inputs

out

max

• max(out: vec4, a: ReadonlyVec4, b: ReadonlyVec4): vec4
• Returns the maximum of two vec4's

Parameters

• out: vec4

the receiving vector

the first operand

the second operand

out

min

• min(out: vec4, a: ReadonlyVec4, b: ReadonlyVec4): vec4
• Returns the minimum of two vec4's

Parameters

• out: vec4

the receiving vector

the first operand

the second operand

out

mul

• mul(out: vec4, a: ReadonlyVec4, b: ReadonlyVec4): vec4
• Multiplies two vec4's

Parameters

• out: vec4

the receiving vector

the first operand

the second operand

out

multiply

• multiply(out: vec4, a: ReadonlyVec4, b: ReadonlyVec4): vec4
• Multiplies two vec4's

Parameters

• out: vec4

the receiving vector

the first operand

the second operand

out

negate

• negate(out: vec4, a: ReadonlyVec4): vec4
• Negates the components of a vec4

Parameters

• out: vec4

the receiving vector

vector to negate

out

normalize

• normalize(out: vec4, a: ReadonlyVec4): vec4
• Normalize a vec4

Parameters

• out: vec4

the receiving vector

vector to normalize

out

random

• random(out: vec4, scale?: number): vec4
• Generates a random vector with the given scale

Parameters

• out: vec4

the receiving vector

out

round

• round(out: vec4, a: ReadonlyVec4): vec4
• Math.round the components of a vec4

Parameters

• out: vec4

the receiving vector

vector to round

out

scale

• scale(out: vec4, a: ReadonlyVec4, b: number): vec4
• Scales a vec4 by a scalar number

Parameters

• out: vec4

the receiving vector

the vector to scale

• b: number

amount to scale the vector by

Returns vec4

out

• scaleAndAdd(out: vec4, a: ReadonlyVec4, b: ReadonlyVec4, scale: number): vec4
• Adds two vec4's after scaling the second operand by a scalar value

Parameters

• out: vec4

the receiving vector

the first operand

the second operand

• scale: number

the amount to scale b by before adding

out

set

• set(out: vec4, x: number, y: number, z: number, w: number): vec4
• Set the components of a vec4 to the given values

Parameters

• out: vec4

the receiving vector

• x: number

X component

• y: number

Y component

• z: number

Z component

• w: number

W component

out

sqrDist

• Calculates the squared euclidian distance between two vec4's

Parameters

the first operand

the second operand

Returns number

squared distance between a and b

sqrLen

• sqrLen(a: ReadonlyVec4): number
• Calculates the squared length of a vec4

Parameters

vector to calculate squared length of

Returns number

squared length of a

squaredDistance

• Calculates the squared euclidian distance between two vec4's

Parameters

the first operand

the second operand

Returns number

squared distance between a and b

squaredLength

• squaredLength(a: ReadonlyVec4): number
• Calculates the squared length of a vec4

Parameters

vector to calculate squared length of

Returns number

squared length of a

str

• str(a: ReadonlyVec4): string
• Returns a string representation of a vector

Parameters

vector to represent as a string

Returns string

string representation of the vector

sub

• sub(out: vec4, a: ReadonlyVec4, b: ReadonlyVec4): vec4
• Subtracts vector b from vector a

Parameters

• out: vec4

the receiving vector

the first operand

the second operand

out

subtract

• subtract(out: vec4, a: ReadonlyVec4, b: ReadonlyVec4): vec4
• Subtracts vector b from vector a

Parameters

• out: vec4

the receiving vector

the first operand

the second operand

out

transformMat4

• transformMat4(out: vec4, a: ReadonlyVec4, m: ReadonlyMat4): vec4
• Transforms the vec4 with a mat4.

Parameters

• out: vec4

the receiving vector

the vector to transform

matrix to transform with

out

transformQuat

• transformQuat(out: vec4, a: ReadonlyVec4, q: ReadonlyQuat): vec4
• Transforms the vec4 with a quat

Parameters

• out: vec4

the receiving vector

the vector to transform

quaternion to transform with

out

zero

• Set the components of a vec4 to zero

Parameters

• out: vec4

the receiving vector

out