Class: Vec4

og/math/Vec4~Vec4

new Vec4(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,constantmodule:og/math/Vec4~Vec4.identityog.math.Vec4

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

Methods

addA(v){og.math.Vec4}

Adds vector to the current.
Name Type Description
v og.math.Vec4
Returns:
Type Description
og.math.Vec4

affinity(){og.math.Vec4}

Makes vector affinity. Thereby fourh component becomes to 1.0.
Returns:
Type Description
og.math.Vec4

clone(){og.math.Vec4}

Returns clone vector.
Returns:
Type Description
og.math.Vec4

copy(v){og.math.Vec4}

Copy input vector's values.
Name Type Description
v og.math.Vec4 Vector to copy.
Returns:
Type Description
og.math.Vec4

dot(v){number}

Gets vectors dot production.
Name Type Description
v og.math.Vec4 Another vector.
Returns:
Type Description
number - Dot product.

equal(p){boolean}

Compares with vector. Returns true if it equals another.
Name Type Description
p og.math.Vec4 Vector to compare.
Returns:
Type Description
boolean

getFrac(){og.math.Vec4}

The vector fract function returns the vector of fractional parts of each value, i.e. x minus floor(x).
Returns:
Type Description
og.math.Vec4

getStep(){og.math.Vec4}

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.Vec4

scale(scale){og.math.Vec4}

Scale current vector.
Name Type Description
scale number Scale value.
Returns:
Type Description
og.math.Vec4

scaleTo(scale){og.Vec3}

Scale current vector to another instance.
Name Type Description
scale number Scale value.
Returns:
Type Description
og.Vec3

set(x, y, z, w){og.math.Vec4}

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.Vec4

subA(v){og.math.Vec4}

Subtract vector from the current.
Name Type Description
v og.math.Vec4 Subtract vector.
Returns:
Type Description
og.math.Vec4

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

Converts vector to a number array.
Returns:
Type Description
Array.<number, number, number, number>

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

Converts vector to a number array.
Deprecated
  • Yes
Returns:
Type Description
Array.<number, number, number, number>

toVec3(){og.Vec3}

Converts to 3d vector, without fourth value.
Returns:
Type Description
og.Vec3

staticmodule:og/math/Vec4~Vec4.fromVec(arr){og.math.Vec4}

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