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 50

Methods

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

Update this vector values to absolute values
Source:
observable_vector2.js, line 194
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 133
Returns:
Reference to this object for method chaining
Type
me.ObservableVector2d

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

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

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

Ceil this vector values
Source:
observable_vector2.js, line 288
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 205
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 218
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 410
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 321
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 398
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 182
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.ObservableVector2d
Source:
observable_vector2.js, line 386
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 333
Returns:
Type
Boolean

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

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

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

Floor this vector values
Source:
observable_vector2.js, line 266
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 243
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 231
Returns:
Reference to this object for method chaining
Type
me.ObservableVector2d

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

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

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

Negate this vector values
Source:
observable_vector2.js, line 310
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 345
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 360
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 372
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 157
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 170
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 115
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 100
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 145
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 433
Returns:
Type
String

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

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