Class: ObservableVector2d

me. ObservableVector2d

new ObservableVector2d(x, y, settings)

A Vector2d object that provide notification by executing the given callback when the vector is changed.
Parameters:
Name Type Argument Default Description
x Number <optional>
0 x value of the vector
y Number <optional>
0 y value of the vector
settings Object additional required parameters
Properties
Name Type Description
onUpdate function the callback to be executed when the vector is changed
Source:
observable_vector2.js, line 18

Extends

Classes

Error

Members

<static> x :Number

x value of the vector
Type:
  • Number
Source:
observable_vector2.js, line 23

<static> y :Number

y value of the vector
Type:
  • Number
Source:
observable_vector2.js, line 51

Methods

<static> abs() → {me.ObservableVector2d}

Update this vector values to absolute values
Source:
observable_vector2.js, line 196
Returns:
Reference to this object for method chaining
Type
me.ObservableVector2d

<static> add(v) → {me.ObservableVector2d}

Add the passed vector to this vector
Parameters:
Name Type Description
v me.ObservableVector2d
Source:
observable_vector2.js, line 135
Returns:
Reference to this object for method chaining
Type
me.ObservableVector2d

<static> ceil() → {me.ObservableVector2d}

Ceil the vector values
Source:
observable_vector2.js, line 279
Returns:
new me.ObservableVector2d
Type
me.ObservableVector2d

<static> ceilSelf() → {me.ObservableVector2d}

Ceil this vector values
Source:
observable_vector2.js, line 290
Returns:
Reference to this object for method chaining
Type
me.ObservableVector2d

<static> clamp(low, high) → {me.ObservableVector2d}

Clamp the vector value within the specified value range
Parameters:
Name Type Description
low Number
high Number
Source:
observable_vector2.js, line 207
Returns:
new me.ObservableVector2d
Type
me.ObservableVector2d

<static> clampSelf(low, high) → {me.ObservableVector2d}

Clamp this vector value within the specified value range
Parameters:
Name Type Description
low Number
high Number
Source:
observable_vector2.js, line 220
Returns:
Reference to this object for method chaining
Type
me.ObservableVector2d

<static> clone() → {me.ObservableVector2d}

return a clone copy of this vector
Source:
observable_vector2.js, line 427
Returns:
new me.ObservableVector2d
Type
me.ObservableVector2d

<static> copy(v) → {me.ObservableVector2d}

Copy the x,y values of the passed vector to this one
Parameters:
Name Type Description
v me.ObservableVector2d
Source:
observable_vector2.js, line 323
Returns:
Reference to this object for method chaining
Type
me.ObservableVector2d

<static> distance(v) → {Number}

return the distance between this vector and the passed one
Parameters:
Name Type Description
v me.ObservableVector2d
Source:
observable_vector2.js, line 415
Returns:
Type
Number

<static> div(value) → {me.ObservableVector2d}

Divide this vector values by the passed value
Parameters:
Name Type Description
value Number
Source:
observable_vector2.js, line 184
Returns:
Reference to this object for method chaining
Type
me.ObservableVector2d

<static> dotProduct(v) → {Number}

return the dot product of this vector and the passed one
Parameters:
Name Type Description
v me.Vector2d | me.ObservableVector2d
Source:
observable_vector2.js, line 388
Returns:
The dot product.
Type
Number

<static> equals(v) → {Boolean}

return true if the two vectors are the same
Parameters:
Name Type Description
v me.ObservableVector2d
Source:
observable_vector2.js, line 335
Returns:
Type
Boolean

<static> floor() → {me.ObservableVector2d}

Floor the vector values
Source:
observable_vector2.js, line 257
Returns:
new me.ObservableVector2d
Type
me.ObservableVector2d

<static> floorSelf() → {me.ObservableVector2d}

Floor this vector values
Source:
observable_vector2.js, line 268
Returns:
Reference to this object for method chaining
Type
me.ObservableVector2d

<static> lerp(v, alpha) → {me.ObservableVector2d}

Linearly interpolate between this vector and the given one.
Parameters:
Name Type Description
v me.Vector2d | me.ObservableVector2d
alpha Number distance along the line (alpha = 0 will be this vector, and alpha = 1 will be the given one).
Source:
observable_vector2.js, line 400
Returns:
Reference to this object for method chaining
Type
me.ObservableVector2d

<static> maxV(v) → {me.ObservableVector2d}

Update this vector with the maximum value between this and the passed vector
Parameters:
Name Type Description
v me.ObservableVector2d
Source:
observable_vector2.js, line 245
Returns:
Reference to this object for method chaining
Type
me.ObservableVector2d

<static> minV(v) → {me.ObservableVector2d}

Update this vector with the minimum value between this and the passed vector
Parameters:
Name Type Description
v me.ObservableVector2d
Source:
observable_vector2.js, line 233
Returns:
Reference to this object for method chaining
Type
me.ObservableVector2d

<static> negate() → {me.ObservableVector2d}

Negate the vector values
Source:
observable_vector2.js, line 301
Returns:
new me.ObservableVector2d
Type
me.ObservableVector2d

<static> negateSelf() → {me.ObservableVector2d}

Negate this vector values
Source:
observable_vector2.js, line 312
Returns:
Reference to this object for method chaining
Type
me.ObservableVector2d

<static> normalize() → {me.ObservableVector2d}

normalize this vector (scale the vector so that its magnitude is 1)
Source:
observable_vector2.js, line 347
Returns:
Reference to this object for method chaining
Type
me.ObservableVector2d

<static> perp() → {me.ObservableVector2d}

change this vector to be perpendicular to what it was before.
(Effectively rotates it 90 degrees in a clockwise direction)
Source:
observable_vector2.js, line 362
Returns:
Reference to this object for method chaining
Type
me.ObservableVector2d

<static> rotate(angle) → {me.ObservableVector2d}

Rotate this vector (counter-clockwise) by the specified angle (in radians).
Parameters:
Name Type Description
angle number The angle to rotate (in radians)
Source:
observable_vector2.js, line 374
Returns:
Reference to this object for method chaining
Type
me.ObservableVector2d

<static> scale(x, y) → {me.ObservableVector2d}

Multiply this vector values by the given scalar
Parameters:
Name Type Argument Default Description
x Number
y Number <optional>
x
Source:
observable_vector2.js, line 159
Returns:
Reference to this object for method chaining
Type
me.ObservableVector2d

<static> scaleV(v) → {me.ObservableVector2d}

Multiply this vector values by the passed vector
Parameters:
Name Type Description
v me.ObservableVector2d
Source:
observable_vector2.js, line 172
Returns:
Reference to this object for method chaining
Type
me.ObservableVector2d

<static> setCallback(onUpdate) → {me.ObservableVector2d}

set the callback to be executed when the vector is changed
Parameters:
Name Type Description
onUpdate function callback
Source:
observable_vector2.js, line 117
Returns:
Reference to this object for method chaining
Type
me.ObservableVector2d

<static> setMuted(x, y) → {me.ObservableVector2d}

set the vector value without triggering the callback
Parameters:
Name Type Description
x Number x value of the vector
y Number y value of the vector
Source:
observable_vector2.js, line 102
Returns:
Reference to this object for method chaining
Type
me.ObservableVector2d

<static> sub(v) → {me.ObservableVector2d}

Substract the passed vector to this vector
Parameters:
Name Type Description
v me.ObservableVector2d
Source:
observable_vector2.js, line 147
Returns:
Reference to this object for method chaining
Type
me.ObservableVector2d

<static> toString() → {String}

convert the object to a string representation
Source:
observable_vector2.js, line 450
Returns:
Type
String

<static> toVector2d() → {me.Vector2d}

return a `me.Vector2d` copy of this `me.ObservableVector2d` object
Source:
observable_vector2.js, line 439
Returns:
new me.Vector2d
Type
me.Vector2d