modeling/maths/vec4

Represents a four dimensional vector.

Source:
See:
  • vec4 for data structure information.

Methods

(static) clone(vector) → {vec4}

Source:

Create a clone of the given vector.

Parameters:
Name Type Description
vector vec4

source vector

Returns:

a new vector

Type
vec4

(static) copy(out, vector) → {vec4}

Source:

Create a copy of the given vector.

Parameters:
Name Type Description
out vec4

receiving vector

vector vec4

source vector

Returns:

out

Type
vec4

(static) create() → {vec4}

Source:

Creates a new vector initialized to [0,0,0,0].

Returns:

a new vector

Type
vec4

(static) dot(a, b) → {Number}

Source:

Calculates the dot product of the given vectors.

Parameters:
Name Type Description
a vec4

first vector

b vec4

second vector

Returns:

dot product

Type
Number

(static) equals(a, b) → {Boolean}

Source:

Compare the given vectors for equality.

Parameters:
Name Type Description
a vec4

first vector

b vec4

second vector

Returns:

true if vectors are equal

Type
Boolean

(static) fromScalar(out, scalar) → {vec4}

Source:

Create a new vector from the given scalar value.

Parameters:
Name Type Description
out vec4

receiving vector

scalar Number
Returns:

out

Type
vec4

(static) fromValues(x, y, z, w) → {vec4}

Source:

Creates a new vector with the given values.

Parameters:
Name Type Description
x Number

X component

y Number

Y component

z Number

Z component

w Number

W component

Returns:

a new vector

Type
vec4

(static) toString(vec) → {String}

Source:

Convert the given vector to a representative string.

Parameters:
Name Type Description
vec vec4

vector to convert

Returns:

representative string

Type
String

(static) transform(out, vector, matrix) → {vec4}

Source:

Transform the given vector using the given matrix.

Parameters:
Name Type Description
out vec4

receiving vector

vector vec4

vector to transform

matrix mat4

matrix to transform with

Returns:

out

Type
vec4