Documentation / base / ObservableVector4
Class: ObservableVector4
Defined in: libs/base/src/math/vector.ts:1676
Observable 4 dimentional vector
Extends
Indexable
[
index:number]:number
Constructors
Constructor
new ObservableVector4(
x,y,z,w):ObservableVector4
Defined in: libs/base/src/math/vector.ts:1197
Creates a new Vector4 initialized with values.
Parameters
x
number
The x component.
y
number
The y component.
z
number
The z component.
w
number
The w component.
Returns
ObservableVector4
Inherited from
Constructor
new ObservableVector4(
elements):ObservableVector4
Defined in: libs/base/src/math/vector.ts:1202
Creates a new Vector4 initialized with values in an array.
Parameters
elements
number[]
Array that contains the x, y, z, w values.
Returns
ObservableVector4
Inherited from
Constructor
new ObservableVector4(
array):ObservableVector4
Defined in: libs/base/src/math/vector.ts:1207
Creates a new Vector4 initialized with values in a Float32Array.
Parameters
array
Float32Array
Float32Array object that contains the x, y, z, w values.
Returns
ObservableVector4
Inherited from
Constructor
new ObservableVector4(
buffer,offset):ObservableVector4
Defined in: libs/base/src/math/vector.ts:1213
Creates a new Vector4 placed on a given ArrayBuffer object.
Parameters
buffer
ArrayBuffer
The array buffer object.
offset
number
The byte offset of the buffer where the vector placed at.
Returns
ObservableVector4
Inherited from
Constructor
new ObservableVector4():
ObservableVector4
Defined in: libs/base/src/math/vector.ts:1217
Creates a new Vector4 filled with zero values.
Returns
ObservableVector4
Inherited from
Accessors
magnitude
Get Signature
get magnitude():
number
Defined in: libs/base/src/math/vector.ts:1284
Get the length of the vector.
Returns
number
Inherited from
magnitudeSq
Get Signature
get magnitudeSq():
number
Defined in: libs/base/src/math/vector.ts:1288
Get the squared length of the vector.
Returns
number
Inherited from
callback
Get Signature
get callback(): () =>
void
Defined in: libs/base/src/math/vector.ts:1680
The callback function which will be executed when the value changed
Returns
() => void
Set Signature
set callback(
cb):void
Defined in: libs/base/src/math/vector.ts:1683
Parameters
cb
() => void
Returns
void
x
Get Signature
get x():
number
Defined in: libs/base/src/math/vector.ts:1694
Get the x component value.
Returns
number
Set Signature
set x(
val):void
Defined in: libs/base/src/math/vector.ts:1697
Get the x component value.
Parameters
val
number
Returns
void
Overrides
y
Get Signature
get y():
number
Defined in: libs/base/src/math/vector.ts:1707
Get the y component value.
Returns
number
Set Signature
set y(
val):void
Defined in: libs/base/src/math/vector.ts:1710
Get the y component value.
Parameters
val
number
Returns
void
Overrides
z
Get Signature
get z():
number
Defined in: libs/base/src/math/vector.ts:1720
Get the z component value.
Returns
number
Set Signature
set z(
val):void
Defined in: libs/base/src/math/vector.ts:1723
Get the z component value.
Parameters
val
number
Returns
void
Overrides
w
Get Signature
get w():
number
Defined in: libs/base/src/math/vector.ts:1733
Get the w component value.
Returns
number
Set Signature
set w(
val):void
Defined in: libs/base/src/math/vector.ts:1736
Get the w component value.
Parameters
val
number
Returns
void
Overrides
Methods
equalsTo()
equalsTo(
other,epsl?):boolean
Defined in: libs/base/src/math/vector.ts:31
Check if all data is close enough to another
Parameters
other
Float32Array<ArrayBuffer>
The data to be compared with.
epsl?
number
Returns
boolean
true if close enough, otherwise false.
Inherited from
toString()
toString():
string
Defined in: libs/base/src/math/vector.ts:51
Convert this to string object.
Returns
string
Inherited from
isNaN()
isNaN():
boolean
Defined in: libs/base/src/math/vector.ts:60
Check the data for the presence of NaN.
Returns
boolean
true if NaN is present, otherwise false.
Inherited from
setRandom()
setRandom(
minValue,maxValue):void
Defined in: libs/base/src/math/vector.ts:74
Generate random vector
Parameters
minValue
number
Minimum value of any component of the vector
maxValue
number
Maximum value of any component of the vector
Returns
void
Inherited from
clone()
clone():
Vector4
Defined in: libs/base/src/math/vector.ts:1252
Creates a new Vector4 initialized with values from this vector.
Returns
The new vector.
Inherited from
xy()
xy():
Vector2
Defined in: libs/base/src/math/vector.ts:1295
Creates a new Vector2 initialized with x, y component of this vector.
Returns
The new vector
Inherited from
xyz()
xyz():
Vector3
Defined in: libs/base/src/math/vector.ts:1302
Creates a new Vector3 initialized with x, y, z component of this vector.
Returns
The new vector
Inherited from
setAndNormalize()
setAndNormalize(
x,y,z,w):ObservableVector4
Defined in: libs/base/src/math/vector.ts:1328
Set component values and then normalize the vector.
Parameters
x
number
The x component value.
y
number
The y component value.
z
number
The z component value.
w
number
The w component value.
Returns
ObservableVector4
self
Inherited from
subBy()
subBy(
other):ObservableVector4
Defined in: libs/base/src/math/vector.ts:1337
Subtract a vector from this vector.
Parameters
other
The vector that will be subtract.
Returns
ObservableVector4
self
Inherited from
addBy()
addBy(
other):ObservableVector4
Defined in: libs/base/src/math/vector.ts:1346
Add a vector to this vector.
Parameters
other
The vector that will be added.
Returns
ObservableVector4
self
Inherited from
combineBy()
combineBy(
other,t0,t1):ObservableVector4
Defined in: libs/base/src/math/vector.ts:1357
Combine a vector to this vector.
Parameters
other
The vector that will be added.
t0
number
Scale factor for this vector
t1
number
Scale factor for other vector
Returns
ObservableVector4
self
Inherited from
mulBy()
mulBy(
other):ObservableVector4
Defined in: libs/base/src/math/vector.ts:1366
Multiply this vector by a vector.
Parameters
other
The vector that will be multiplied by.
Returns
ObservableVector4
self
Inherited from
divBy()
divBy(
other):ObservableVector4
Defined in: libs/base/src/math/vector.ts:1375
Divide this vector by a vector.
Parameters
other
The vector that will be divide by.
Returns
ObservableVector4
self
Inherited from
scaleBy()
scaleBy(
f):ObservableVector4
Defined in: libs/base/src/math/vector.ts:1384
Scale this vector by a scalar number.
Parameters
f
number
amount to scale this vector by.
Returns
ObservableVector4
self
Inherited from
inplaceNormalize()
inplaceNormalize():
ObservableVector4
Defined in: libs/base/src/math/vector.ts:1392
Normalize this vector inplace.
Returns
ObservableVector4
self
Inherited from
inplaceInverse()
inplaceInverse():
ObservableVector4
Defined in: libs/base/src/math/vector.ts:1400
Inverse this vector inplace.
Returns
ObservableVector4
self
Inherited from
inplaceMin()
inplaceMin(
other):ObservableVector4
Defined in: libs/base/src/math/vector.ts:1409
Set the component values to the minimum of this vector and another vector.
Parameters
other
The vector that to be compared with.
Returns
ObservableVector4
self
Inherited from
inplaceMax()
inplaceMax(
other):ObservableVector4
Defined in: libs/base/src/math/vector.ts:1418
Set the component values to the maximum of this vector and another vector.
Parameters
other
The vector that to be compared with.
Returns
ObservableVector4
self
Inherited from
zero()
staticzero():Vector4
Defined in: libs/base/src/math/vector.ts:1426
Creates a new Vector4 initialized with zero values.
Returns
The new vector
Inherited from
one()
staticone():Vector4
Defined in: libs/base/src/math/vector.ts:1433
Creates a new Vector4 initialized with one.
Returns
The new vector
Inherited from
axisPX()
staticaxisPX():Vector4
Defined in: libs/base/src/math/vector.ts:1440
Creates a new Vector4 pointing in the positive direction of the X axis, i.e. vec4(1, 0, 0, 0)
Returns
The new vector
Inherited from
axisNX()
staticaxisNX():Vector4
Defined in: libs/base/src/math/vector.ts:1447
Creates a new Vector4 pointing in the negative direction of the X axis, i.e. vec4(-1, 0, 0, 0)
Returns
The new vector
Inherited from
axisPY()
staticaxisPY():Vector4
Defined in: libs/base/src/math/vector.ts:1454
Creates a new Vector4 pointing in the positive direction of the Y axis, i.e. vec4(0, 1, 0, 0)
Returns
The new vector
Inherited from
axisNY()
staticaxisNY():Vector4
Defined in: libs/base/src/math/vector.ts:1461
Creates a new Vector4 pointing in the negative direction of the Y axis, i.e. vec4(0, -1, 0, 0)
Returns
The new vector
Inherited from
axisPZ()
staticaxisPZ():Vector4
Defined in: libs/base/src/math/vector.ts:1468
Creates a new Vector4 pointing in the positive direction of the Z axis, i.e. vec4(0, 0, 1, 0)
Returns
The new vector
Inherited from
axisNZ()
staticaxisNZ():Vector4
Defined in: libs/base/src/math/vector.ts:1475
Creates a new Vector4 pointing in the negative direction of the Z axis, i.e. vec4(0, 0, -1, 0)
Returns
The new vector
Inherited from
axisPW()
staticaxisPW():Vector4
Defined in: libs/base/src/math/vector.ts:1482
Creates a new Vector4 pointing in the positive direction of the W axis, i.e. vec4(0, 0, 0, 1)
Returns
The new vector
Inherited from
axisNW()
staticaxisNW():Vector4
Defined in: libs/base/src/math/vector.ts:1489
Creates a new Vector4 pointing in the negative direction of the W axis, i.e. vec4(0, 0, 0, -1)
Returns
The new vector
Inherited from
normalize()
staticnormalize(v,result?):Vector4
Defined in: libs/base/src/math/vector.ts:1498
Normalize a Vector4
Parameters
v
The input vector
result?
The output vector (can be the same as v). if not specified, a new vector will be created.
Returns
The output vector
Inherited from
inverse()
staticinverse(v,result?):Vector4
Defined in: libs/base/src/math/vector.ts:1512
Inverse a Vector4
Parameters
v
The input vector
result?
The output vector (can be the same vector as v). if not specified, a new vector will be created.
Returns
The output vector
Inherited from
sub()
staticsub(a,b,result?):Vector4
Defined in: libs/base/src/math/vector.ts:1526
Subtract two Vector4's.
Parameters
a
The first operand.
b
The second operand.
result?
The output vector (can be the same vector as a or b). if not specified, a new vector will be created.
Returns
The output vector
Inherited from
add()
staticadd(a,b,result?):Vector4
Defined in: libs/base/src/math/vector.ts:1540
Add two Vector4's.
Parameters
a
The first operand.
b
The second operand.
result?
The output vector (can be the same vector as a or b). if not specified, a new vector will be created.
Returns
The output vector
Inherited from
combine()
staticcombine(a,b,t0,t1,result?):Vector4
Defined in: libs/base/src/math/vector.ts:1556
Combine two Vector4's.
Parameters
a
The first operand.
b
The second operand.
t0
number
Scale factor for the first operand
t1
number
Scale factor for the second operand
result?
The output vector (can be the same vector as a or b). if not specified, a new vector will be created.
Returns
The output vector
Inherited from
lerp()
staticlerp(a,b,t,result?):Vector4
Defined in: libs/base/src/math/vector.ts:1571
Linearly interpolate between two Vector4's.
Parameters
a
The first operand.
b
The second operand.
t
number
The interpolation factor. The result is equal to a when t = 0 and equal to b when t = 1.
result?
The output vector (can be the same vector as a or b). if not specified, a new vector will be created.
Returns
The output vector
Inherited from
mul()
staticmul(a,b,result?):Vector4
Defined in: libs/base/src/math/vector.ts:1585
Multiply two Vector4's.
Parameters
a
The first operand.
b
The second operand.
result?
The output vector (can be the same vector as a or b). if not specified, a new vector will be created.
Returns
The output vector
Inherited from
div()
staticdiv(a,b,result?):Vector4
Defined in: libs/base/src/math/vector.ts:1599
Divide two Vector4's.
Parameters
a
The first operand.
b
The second operand.
result?
The output vector (can be the same vector as a or b). if not specified, a new vector will be created.
Returns
The output vector
Inherited from
scale()
staticscale(a,b,result?):Vector4
Defined in: libs/base/src/math/vector.ts:1613
Scale a Vector4 by a scalar number.
Parameters
a
The vector to be scaled.
b
number
The scalar number.
result?
The output vector (can be the same vector as a). if not specified, a new vector will be created.
Returns
The output vector
Inherited from
min()
staticmin(a,b,result?):Vector4
Defined in: libs/base/src/math/vector.ts:1627
Calculates the minimum of two Vector4's.
Parameters
a
The first operand.
b
The second operand.
result?
The output vector (can be the same vector as a or b). if not specified, a new vector will be created.
Returns
The output vector
Inherited from
max()
staticmax(a,b,result?):Vector4
Defined in: libs/base/src/math/vector.ts:1641
Calculates the maximum of two Vector4's.
Parameters
a
The first operand.
b
The second operand.
result?
The output vector (can be the same vector as a or b). if not specified, a new vector will be created.
Returns
The output vector
Inherited from
abs()
staticabs(a,result?):Vector4
Defined in: libs/base/src/math/vector.ts:1654
Calculates the absolute values of a Vector4.
Parameters
a
The input vector.
result?
The output vector (can be the same vector as a or b). if not specified, a new vector will be created.
Returns
The output vector
Inherited from
dot()
staticdot(a,b):number
Defined in: libs/base/src/math/vector.ts:1667
Calculates the dot product of two Vector4's.
Parameters
a
The first operand.
b
The second operand.
Returns
number
dot product of a and b
Inherited from
setCallback()
setCallback(
cb):ObservableVector4
Defined in: libs/base/src/math/vector.ts:1687
Set callback
Parameters
cb
() => void
Returns
ObservableVector4
setXYZW()
setXYZW(
x,y,z,w):ObservableVector4
Defined in: libs/base/src/math/vector.ts:1746
Set component values.
Parameters
x
number
The x component value.
y
number
The y component value.
z
number
The z component value.
w
number
The w component value.
Returns
ObservableVector4
self
Overrides
copyWithin()
copyWithin(
target,start,end?):ObservableVector4
Defined in: libs/base/src/math/vector.ts:1760
Inherited from Float32Array.copyWithin
Parameters
target
number
start
number
end?
number
Returns
ObservableVector4
Overrides
Vector4.copyWithin
fill()
fill(
value,start?,end?):ObservableVector4
Defined in: libs/base/src/math/vector.ts:1768
Inherited from Float32Array.fill
Parameters
value
number
start?
number
end?
number
Returns
ObservableVector4
Overrides
Vector4.fill
reverse()
reverse():
ObservableVector4
Defined in: libs/base/src/math/vector.ts:1776
Inherited from Float32Array.reverse
Returns
ObservableVector4
Overrides
Vector4.reverse
set()
set(
array,offset?):void
Defined in: libs/base/src/math/vector.ts:1784
Inherited from Float32Array.set
Parameters
array
ArrayLike<number>
offset?
number
Returns
void
Overrides
Vector4.set
sort()
sort(
compareFn?):ObservableVector4
Defined in: libs/base/src/math/vector.ts:1791
Inherited from Float32Array.sort
Parameters
compareFn?
(a, b) => number
Returns
ObservableVector4
Overrides
Vector4.sort