# Class Vector4

Serializable THREE.js Vector4

class

• Vector4
• Vector4

height: number
isVector4: true
w: number
width: number
x: number
y: number
z: number

## Methods

• Adds v to this vector.

#### Returns Vector4

• Sets this vector to a + b.

#### Returns Vector4

• Copies value of v to this vector.

#### Returns Vector4

• Divides this vector by scalar s. Set vector to ( 0, 0, 0 ) if s == 0.

#### Returns Vector4

• Computes dot product of this vector and v.

#### Returns number

• Checks for strict equality of this vector and v.

• #### Returns Vector4

• Sets this vector's x, y, z and w value from the provided array or array-like.

#### Parameters

• ##### array: number[] | ArrayLike<number>

the source array or array-like.

• ##### `Optional` offset: number

(optional) offset into the array. Default is 0.

#### Returns number

• Computes length of this vector.

#### Returns number

• Computes squared length of this vector.

#### Returns number

• Linearly interpolate between this vector and v with alpha factor.

#### Returns Vector4

• Computes the Manhattan length of this vector.

#### Returns Vector4

• Multiplies this vector by scalar s.

#### Returns Vector4

• Inverts this vector.

#### Returns Vector4

• Normalizes this vector.

#### Returns Vector4

• Sets this vector's x, y, z and w from Math.random

• #### Returns Vector4

• Sets value of this vector.

• #### Parameters

• ##### q: Quaternion

is assumed to be normalized

• #### Parameters

• ##### m: Matrix4

assumes the upper 3x3 of m is a pure rotation matrix (i.e, unscaled)

#### Returns Vector4

• Normalizes this vector and multiplies it by l.

#### Returns Vector4

• Sets all values of this vector.

#### Returns Vector4

• Sets w component of this vector.

#### Returns Vector4

• Sets X component of this vector.

#### Returns Vector4

• Sets Y component of this vector.

#### Returns Vector4

• Sets Z component of this vector.

#### Returns Vector4

• Subtracts v from this vector.

#### Returns Vector4

• Sets this vector to a - b.

#### Returns Vector4

• Returns an array [x, y, z, w], or copies x, y, z and w into the provided array.

### Returns

The created or provided array.

#### Parameters

• ##### `Optional` array: number[]

(optional) array to store the vector to. If this is not provided, a new array will be created.

• ##### `Optional` offset: number

(optional) optional offset into the array.

#### Returns Vector4Tuple

• Copies x, y, z and w into the provided array-like.

### Returns

The provided array-like.

#### Parameters

• ##### array: ArrayLike<number>

array-like to store the vector to.

• ##### `Optional` offset: number

(optional) optional offset into the array-like.