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 46

Methods

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

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

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

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

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

Ceil this vector values
Source:
observable_vector2.js, line 275
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 192
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 205
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 397
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 308
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 385
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 169
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 373
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 320
Returns:
Type
Boolean

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

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

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

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

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

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

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

Negate this vector values
Source:
observable_vector2.js, line 297
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 332
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 347
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 359
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 144
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 157
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 102
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 87
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 132
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 420
Returns:
Type
String

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

return a `me.Vector2d` copy of this `me.ObservableVector2d` object
Source:
observable_vector2.js, line 409
Returns:
new me.Vector2d
Type
me.Vector2d
Copyright © 2011 - 2017, Olivier Biot, Jason Oster, Aaron McLeod
Documentation generated by JSDoc 3.4.0 on 2017-02-28T11:37:41+08:00 using the DocStrap template modified by codename-.