ObservableVector3d

class ObservableVector3d extends Vector3d

A Vector3d object that provide notification by executing the given callback when the vector is changed.

Constructor


new ObservableVector3d(x: number, y: number, z: number, settings: object) → {}
Parameters:
Name Type Attributes Default Description
x number 0

x value of the vector

y number 0

y value of the vector

z number 0

z value of the vector

settings object

additional required parameters

settings.onUpdate Function

the callback to be executed when the vector is changed

settings.scope object

<optional>

the value to use as this when calling onUpdate

Summary


Properties from ObservableVector3d

number
x
number
y
number
z

Methods from ObservableVector3d

ObservableVector3d
abs()
ObservableVector3d
add(v: Vector2d | Vector3d | ObservableVector2d | ObservableVector3d)
ObservableVector3d
ceil()
ObservableVector3d
ceilSelf()
ObservableVector3d
clamp(low: number, high: number)
ObservableVector3d
clampSelf(low: number, high: number)
ObservableVector3d
clone()
ObservableVector3d
copy(v: Vector2d | Vector3d | ObservableVector2d | ObservableVector3d)
ObservableVector3d
cross(v: Vector3d | ObservableVector3d)
number
distance(v: Vector2d | Vector3d | ObservableVector2d | ObservableVector3d)
ObservableVector3d
div(n: number)
number
dot(v: Vector2d | Vector3d | ObservableVector2d | ObservableVector3d)
boolean
equals(v: Vector2d | Vector3d | ObservableVector2d | ObservableVector3d)
ObservableVector3d
floor()
ObservableVector3d
floorSelf()
ObservableVector3d
lerp(v: Vector3d | ObservableVector3d, alpha: number)
ObservableVector3d
maxV(v: Vector2d | Vector3d | ObservableVector2d | ObservableVector3d)
ObservableVector3d
minV(v: Vector2d | Vector3d | ObservableVector2d | ObservableVector3d)
ObservableVector3d
moveTowards(target: Vector2d | ObservableVector2d | Vector3d | ObservableVector3d, step: number)
ObservableVector3d
negate()
ObservableVector3d
negateSelf()
ObservableVector3d
perp()
ObservableVector3d
rotate(angle: number, v: Vector2d | ObservableVector2d)
ObservableVector3d
scale(x: number, y: number, z: number)
ObservableVector3d
scaleV(v: Vector2d | Vector3d | ObservableVector2d | ObservableVector3d)
ObservableVector3d
setCallback(fn: Function, scope: Function)
ObservableVector3d
setMuted(x: number, y: number, z: number)
ObservableVector3d
sub(v: Vector2d | Vector3d | ObservableVector2d | ObservableVector3d)
string
toString()
Vector3d
toVector3d()

Public Properties


x observable_vector3.js:41
x: number

number

x value of the vector

y observable_vector3.js:62
y: number

number

y value of the vector

z observable_vector3.js:84
z: number

number

z value of the vector

Public Methods


abs observable_vector3.js:215
abs() → {ObservableVector3d}

Update this vector values to absolute values

Returns:
Type Description
ObservableVector3d

Reference to this object for method chaining

add observable_vector3.js:158
add(v: Vector2d | Vector3d | ObservableVector2d | ObservableVector3d) → {ObservableVector3d}

Add the passed vector to this vector

Parameters:
Name Type Description
v Vector2d | Vector3d | ObservableVector2d | ObservableVector3d
Returns:
Type Description
ObservableVector3d

Reference to this object for method chaining

ceil observable_vector3.js:319
ceil() → {ObservableVector3d}

Ceil the vector values

Returns:
Type Description
ObservableVector3d

new me.ObservableVector3d

ceilSelf observable_vector3.js:334
ceilSelf() → {ObservableVector3d}

Ceil this vector values

Returns:
Type Description
ObservableVector3d

Reference to this object for method chaining

clamp observable_vector3.js:229
clamp(low: number, high: number) → {ObservableVector3d}

Clamp the vector value within the specified value range

Parameters:
Name Type Description
low number
high number
Returns:
Type Description
ObservableVector3d

new me.ObservableVector3d

clampSelf observable_vector3.js:246
clampSelf(low: number, high: number) → {ObservableVector3d}

Clamp this vector value within the specified value range

Parameters:
Name Type Description
low number
high number
Returns:
Type Description
ObservableVector3d

Reference to this object for method chaining

clone observable_vector3.js:515
clone() → {ObservableVector3d}

return a clone copy of this vector

Returns:
Type Description
ObservableVector3d

new me.ObservableVector3d

copy observable_vector3.js:369
copy(v: Vector2d | Vector3d | ObservableVector2d | ObservableVector3d) → {ObservableVector3d}

Copy the components of the given vector into this one

Parameters:
Name Type Description
v Vector2d | Vector3d | ObservableVector2d | ObservableVector3d
Returns:
Type Description
ObservableVector3d

Reference to this object for method chaining

cross observable_vector3.js:440
cross(v: Vector3d | ObservableVector3d) → {ObservableVector3d}

calculate the cross product of this vector and the passed one

Parameters:
Name Type Description
v Vector3d | ObservableVector3d
Returns:
Type Description
ObservableVector3d

Reference to this object for method chaining

distance observable_vector3.js:501
distance(v: Vector2d | Vector3d | ObservableVector2d | ObservableVector3d) → {number}

return the distance between this vector and the passed one

Parameters:
Name Type Description
v Vector2d | Vector3d | ObservableVector2d | ObservableVector3d
Returns:
Type Description
number
div observable_vector3.js:204
div(n: number) → {ObservableVector3d}

Divide this vector values by the passed value

Parameters:
Name Type Description
n number

the value to divide the vector by

Returns:
Type Description
ObservableVector3d

Reference to this object for method chaining

dot observable_vector3.js:429
dot(v: Vector2d | Vector3d | ObservableVector2d | ObservableVector3d) → {number}

return the dot product of this vector and the passed one

Parameters:
Name Type Description
v Vector2d | Vector3d | ObservableVector2d | ObservableVector3d
Returns:
Type Description
number

The dot product.

equals observable_vector3.js:380
equals(v: Vector2d | Vector3d | ObservableVector2d | ObservableVector3d) → {boolean}

return true if the two vectors are the same

Parameters:
Name Type Description
v Vector2d | Vector3d | ObservableVector2d | ObservableVector3d
Returns:
Type Description
boolean
floor observable_vector3.js:294
floor() → {ObservableVector3d}

Floor the vector values

Returns:
Type Description
ObservableVector3d

new me.ObservableVector3d

floorSelf observable_vector3.js:309
floorSelf() → {ObservableVector3d}

Floor this vector values

Returns:
Type Description
ObservableVector3d

Reference to this object for method chaining

lerp observable_vector3.js:458
lerp(v: Vector3d | ObservableVector3d, alpha: number) → {ObservableVector3d}

Linearly interpolate between this vector and the given one.

Parameters:
Name Type Description
v Vector3d | ObservableVector3d
alpha number

distance along the line (alpha = 0 will be this vector, and alpha = 1 will be the given one).

Returns:
Type Description
ObservableVector3d

Reference to this object for method chaining

maxV observable_vector3.js:278
maxV(v: Vector2d | Vector3d | ObservableVector2d | ObservableVector3d) → {ObservableVector3d}

Update this vector with the maximum value between this and the passed vector

Parameters:
Name Type Description
v Vector2d | Vector3d | ObservableVector2d | ObservableVector3d
Returns:
Type Description
ObservableVector3d

Reference to this object for method chaining

minV observable_vector3.js:262
minV(v: Vector2d | Vector3d | ObservableVector2d | ObservableVector3d) → {ObservableVector3d}

Update this vector with the minimum value between this and the passed vector

Parameters:
Name Type Description
v Vector2d | Vector3d | ObservableVector2d | ObservableVector3d
Returns:
Type Description
ObservableVector3d

Reference to this object for method chaining

moveTowards observable_vector3.js:474
moveTowards(target: Vector2d | ObservableVector2d | Vector3d | ObservableVector3d, step: number) → {ObservableVector3d}

interpolate the position of this vector on the x and y axis towards the given one while ensure that the distance never exceeds the given step.

Parameters:
Name Type Description
target Vector2d | ObservableVector2d | Vector3d | ObservableVector3d
step number

the maximum step per iteration (Negative values will push the vector away from the target)

Returns:
Type Description
ObservableVector3d

Reference to this object for method chaining

negate observable_vector3.js:344
negate() → {ObservableVector3d}

Negate the vector values

Returns:
Type Description
ObservableVector3d

new me.ObservableVector3d

negateSelf observable_vector3.js:359
negateSelf() → {ObservableVector3d}

Negate this vector values

Returns:
Type Description
ObservableVector3d

Reference to this object for method chaining

perp observable_vector3.js:391
perp() → {ObservableVector3d}

change this vector to be perpendicular to what it was before.
(Effectively rotates it 90 degrees in a clockwise direction)

Returns:
Type Description
ObservableVector3d

Reference to this object for method chaining

rotate observable_vector3.js:402
rotate(angle: number, v: Vector2d | ObservableVector2d) → {ObservableVector3d}

Rotate this vector (counter-clockwise) by the specified angle (in radians).

Parameters:
Name Type Attributes Description
angle number

The angle to rotate (in radians)

v Vector2d | ObservableVector2d

<optional>

an optional point to rotate around (on the same z axis)

Returns:
Type Description
ObservableVector3d

Reference to this object for method chaining

scale observable_vector3.js:180
scale(x: number, y: number, z: number) → {ObservableVector3d}

Multiply this vector values by the given scalar

Parameters:
Name Type Attributes Default Description
x number
y number

<optional>

x
z number

<optional>

1
Returns:
Type Description
ObservableVector3d

Reference to this object for method chaining

scaleV observable_vector3.js:193
scaleV(v: Vector2d | Vector3d | ObservableVector2d | ObservableVector3d) → {ObservableVector3d}

Multiply this vector values by the passed vector

Parameters:
Name Type Description
v Vector2d | Vector3d | ObservableVector2d | ObservableVector3d
Returns:
Type Description
ObservableVector3d

Reference to this object for method chaining

setCallback observable_vector3.js:139
setCallback(fn: Function, scope: Function) → {ObservableVector3d}

set the callback to be executed when the vector is changed

Parameters:
Name Type Attributes Default Description
fn Function

callback

scope Function

<optional>

null

scope

Returns:
Type Description
ObservableVector3d

Reference to this object for method chaining

setMuted observable_vector3.js:123
setMuted(x: number, y: number, z: number) → {ObservableVector3d}

set the vector value without triggering the callback

Parameters:
Name Type Attributes Default Description
x number

x value of the vector

y number

y value of the vector

z number

<optional>

0

z value of the vector

Returns:
Type Description
ObservableVector3d

Reference to this object for method chaining

sub observable_vector3.js:169
sub(v: Vector2d | Vector3d | ObservableVector2d | ObservableVector3d) → {ObservableVector3d}

Substract the passed vector to this vector

Parameters:
Name Type Description
v Vector2d | Vector3d | ObservableVector2d | ObservableVector3d
Returns:
Type Description
ObservableVector3d

Reference to this object for method chaining

toString observable_vector3.js:540
toString() → {string}

convert the object to a string representation

Returns:
Type Description
string
toVector3d observable_vector3.js:530
toVector3d() → {Vector3d}

return a me.Vector3d copy of this me.ObservableVector3d object

Returns:
Type Description
Vector3d

new me.Vector3d


Powered by webdoc!