new ObservableVector2d(xopt, yopt, settings)
A Vector2d object that provide notification by executing the given callback when the vector is changed.
Parameters:
Name | Type | Attributes | 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
|
Extends
Members
-
static x :Number
-
x value of the vector
-
static y :Number
-
y value of the vector
Methods
-
static abs() → {me.ObservableVector2d}
-
Update this vector values to absolute values
-
static add(v) → {me.ObservableVector2d}
-
Add the passed vector to this vector
Parameters:
Name Type Description v
me.ObservableVector2d -
static ceil() → {me.ObservableVector2d}
-
Ceil the vector values
-
static ceilSelf() → {me.ObservableVector2d}
-
Ceil this vector values
-
static clamp(low, high) → {me.ObservableVector2d}
-
Clamp the vector value within the specified value range
Parameters:
Name Type Description low
Number high
Number -
static clampSelf(low, high) → {me.ObservableVector2d}
-
Clamp this vector value within the specified value range
Parameters:
Name Type Description low
Number high
Number -
static clone() → {me.ObservableVector2d}
-
return a clone copy of this vector
-
static copy(v) → {me.ObservableVector2d}
-
Copy the x,y values of the passed vector to this one
Parameters:
Name Type Description v
me.ObservableVector2d -
static distance(v) → {Number}
-
return the distance between this vector and the passed one
Parameters:
Name Type Description v
me.ObservableVector2d Returns:
Number -
static div(value) → {me.ObservableVector2d}
-
Divide this vector values by the passed value
Parameters:
Name Type Description value
Number -
static dotProduct(v) → {Number}
-
return the dot product of this vector and the passed one
Parameters:
Name Type Description v
me.Vector2d | me.ObservableVector2d Returns:
Number -The dot product.
-
static equals(v) → {Boolean}
-
return true if the two vectors are the same
Parameters:
Name Type Description v
me.ObservableVector2d Returns:
Boolean -
static floor() → {me.ObservableVector2d}
-
Floor the vector values
-
static floorSelf() → {me.ObservableVector2d}
-
Floor this vector values
-
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).
-
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 -
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 -
static negate() → {me.ObservableVector2d}
-
Negate the vector values
-
static negateSelf() → {me.ObservableVector2d}
-
Negate this vector values
-
static perp() → {me.ObservableVector2d}
-
change this vector to be perpendicular to what it was before.
(Effectively rotates it 90 degrees in a clockwise direction) -
static rotate(angle, vopt) → {me.ObservableVector2d}
-
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
me.Vector2d | me.ObservableVector2d <optional>
an optional point to rotate around
-
static scale(x, yopt) → {me.ObservableVector2d}
-
Multiply this vector values by the given scalar
Parameters:
Name Type Attributes Default Description x
Number y
Number <optional>
x -
static scaleV(v) → {me.ObservableVector2d}
-
Multiply this vector values by the passed vector
Parameters:
Name Type Description v
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
-
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
-
static sub(v) → {me.ObservableVector2d}
-
Substract the passed vector to this vector
Parameters:
Name Type Description v
me.ObservableVector2d -
static toString() → {String}
-
convert the object to a string representation
Returns:
String -
static toVector2d() → {me.Vector2d}
-
return a
me.Vector2d
copy of thisme.ObservableVector2d
object