Class: Vector4

og.math.Vector4

new og.math.Vector4(x, y, z, w)

Class represents a 4d vector.
Name Type Description
x number optional First value.
y number optional Second value.
z number optional Third value.
w number optional Fourth value.

Members

wnumber

xnumber

ynumber

znumber

static,constantog.math.Vector4.identityog.math.Vector4

Identity vector [0,0,0,1].

Methods

Adds vector to the current.
Name Type Description
v og.math.Vector4
Returns:
Type Description
og.math.Vector4
Makes vector affinity. Thereby fourh component becomes to 1.0.
Returns:
Type Description
og.math.Vector4
Returns clone vector.
Returns:
Type Description
og.math.Vector4
Copy input vector's values.
Name Type Description
v og.math.Vector4 Vector to copy.
Returns:
Type Description
og.math.Vector4

equal(p){boolean}

Compares with vector. Returns true if it equals another.
Name Type Description
p og.math.Vector4 Vector to compare.
Returns:
Type Description
boolean
The vector fract function returns the vector of fractional parts of each value, i.e. x minus floor(x).
Returns:
Type Description
og.math.Vector4
Vector's edge function that returns vector where each component is 0.0 if it's smaller then edge and otherwise 1.0.
Returns:
Type Description
og.math.Vector4
Scale current vector.
Name Type Description
scale number Scale value.
Returns:
Type Description
og.math.Vector4
Scale current vector to another instance.
Name Type Description
scale number Scale value.
Returns:
Type Description
og.math.Vector3
Sets vector's values.
Name Type Description
x number Value X.
y number Value Y.
z number Value Z.
w number Value W.
Returns:
Type Description
og.math.Vector4
Subtract vector from the current.
Name Type Description
v og.math.Vector4 Subtract vector.
Returns:
Type Description
og.math.Vector4

toVec(){Array.<number, number, number, number>}

Converts vector to a number array.
Returns:
Type Description
Array.<number, number, number, number>
Converts to 3d vector, without fourth value.
Returns:
Type Description
og.math.Vector3

staticog.math.Vector4.fromVec(arr){og.math.Vector4}

Creates 4d vector from array.
Name Type Description
arr Array.<number, number, number, number>
Returns:
Type Description
og.math.Vector4