Options
All
• Public
• Public/Protected
• All

# Module vec4

## Functions

• Adds two vec4's

#### Parameters

• ##### out: IArray

the receiving vector

• ##### a: IArray

the first operand

• ##### b: IArray

the second operand

out

### clone

• Creates a new vec4 initialized with values from an existing vector

#### Parameters

• ##### a: IArray

vector to clone

#### Returns IArray

a new 4D vector

### copy

• Copy the values from one vec4 to another

#### Parameters

• ##### out: IArray

the receiving vector

• ##### a: IArray

the source vector

out

### create

• Creates a new, empty vec4

#### Returns IArray

a new 4D vector

### dist

• Calculates the euclidian distance between two vec4's

#### Parameters

• ##### a: IArray

the first operand

• ##### b: IArray

the second operand

#### Returns number

distance between a and b

### distance

• Calculates the euclidian distance between two vec4's

#### Parameters

• ##### a: IArray

the first operand

• ##### b: IArray

the second operand

#### Returns number

distance between a and b

### div

• Divides two vec4's

#### Parameters

• ##### out: IArray

the receiving vector

• ##### a: IArray

the first operand

• ##### b: IArray

the second operand

out

### divide

• Divides two vec4's

#### Parameters

• ##### out: IArray

the receiving vector

• ##### a: IArray

the first operand

• ##### b: IArray

the second operand

out

### dot

• Calculates the dot product of two vec4's

#### Parameters

• ##### a: IArray

the first operand

• ##### b: IArray

the second operand

#### Returns number

dot product of a and b

### forEach

• forEach(out: IArray, string: number, offset: number, count: number, callback: function, arg: any): IArray
• forEach(out: IArray, string: number, offset: number, count: number, callback: function): IArray
• Perform some operation over an array of vec4s.

function

#### Parameters

• ##### 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

#### Returns IArray

a

• Perform some operation over an array of vec4s.

function

#### Parameters

• ##### 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

a

### fromValues

• fromValues(x: number, y: number, z: number, w: number): IArray
• 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 IArray

a new 4D vector

### inverse

• Returns the inverse of the components of a vec4

#### Parameters

• ##### out: IArray

the receiving vector

• ##### a: IArray

vector to invert

out

### len

• Calculates the length of a vec4

#### Parameters

• ##### a: IArray

vector to calculate length of

length of a

### length

• Calculates the length of a vec4

#### Parameters

• ##### a: IArray

vector to calculate length of

length of a

### lerp

• Performs a linear interpolation between two vec4's

#### Parameters

• ##### out: IArray

the receiving vector

• ##### a: IArray

the first operand

• ##### b: IArray

the second operand

• ##### t: number

interpolation amount between the two inputs

out

### max

• Returns the maximum of two vec4's

#### Parameters

• ##### out: IArray

the receiving vector

• ##### a: IArray

the first operand

• ##### b: IArray

the second operand

out

### min

• Returns the minimum of two vec4's

#### Parameters

• ##### out: IArray

the receiving vector

• ##### a: IArray

the first operand

• ##### b: IArray

the second operand

out

### mul

• Multiplies two vec4's

#### Parameters

• ##### out: IArray

the receiving vector

• ##### a: IArray

the first operand

• ##### b: IArray

the second operand

out

### multiply

• Multiplies two vec4's

#### Parameters

• ##### out: IArray

the receiving vector

• ##### a: IArray

the first operand

• ##### b: IArray

the second operand

out

### negate

• Negates the components of a vec4

#### Parameters

• ##### out: IArray

the receiving vector

• ##### a: IArray

vector to negate

out

### normalize

• Normalize a vec4

#### Parameters

• ##### out: IArray

the receiving vector

• ##### a: IArray

vector to normalize

out

### random

• Generates a random unit vector

#### Parameters

• ##### out: IArray

the receiving vector

#### Returns IArray

out

• Generates a random vector with the given scale

#### Parameters

• ##### out: IArray

the receiving vector

out

### scale

• Scales a vec4 by a scalar number

#### Parameters

• ##### out: IArray

the receiving vector

• ##### a: IArray

the vector to scale

• ##### b: number

amount to scale the vector by

#### Returns IArray

out

• Adds two vec4's after scaling the second operand by a scalar value

#### Parameters

• ##### out: IArray

the receiving vector

• ##### a: IArray

the first operand

• ##### b: IArray

the second operand

• ##### scale: number

the amount to scale b by before adding

out

### set

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

#### Parameters

• ##### out: IArray

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

• ##### a: IArray

the first operand

• ##### b: IArray

the second operand

#### Returns number

squared distance between a and b

### sqrLen

• Calculates the squared length of a vec4

#### Parameters

• ##### a: IArray

vector to calculate squared length of

#### Returns number

squared length of a

### squaredDistance

• Calculates the squared euclidian distance between two vec4's

#### Parameters

• ##### a: IArray

the first operand

• ##### b: IArray

the second operand

#### Returns number

squared distance between a and b

### squaredLength

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

#### Parameters

• ##### a: IArray

vector to calculate squared length of

#### Returns number

squared length of a

### str

• Returns a string representation of a vector

#### Returns string

string representation of the vector

### sub

• Subtracts vector b from vector a

#### Parameters

• ##### out: IArray

the receiving vector

• ##### a: IArray

the first operand

• ##### b: IArray

the second operand

out

### subtract

• Subtracts vector b from vector a

#### Parameters

• ##### out: IArray

the receiving vector

• ##### a: IArray

the first operand

• ##### b: IArray

the second operand

out

### transformMat4

• Transforms the vec4 with a mat4.

#### Parameters

• ##### out: IArray

the receiving vector

• ##### a: IArray

the vector to transform

out

### transformQuat

• Transforms the vec4 with a quat

#### Parameters

• ##### out: IArray

the receiving vector

• ##### a: IArray

the vector to transform

#### Returns IArray

out

Generated using TypeDoc