Class: Vector2d

me. Vector2d

new Vector2d(x, y)

a generic 2D Vector Object
Parameters:
Name Type Argument Default Description
x Number <optional>
0 x value of the vector
y Number <optional>
0 y value of the vector
Source:
vector2.js, line 17

Extends

Classes

Error

Members

<static> x :Number

x value of the vector
Type:
  • Number
Source:
vector2.js, line 49

<static> y :Number

y value of the vector
Type:
  • Number
Source:
vector2.js, line 58

Methods

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

Update this vector values to absolute values
Source:
vector2.js, line 176
Returns:
Reference to this object for method chaining
Type
me.Vector2d

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

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

<static> angle(v) → {Number}

return the angle between this vector and the passed one
Parameters:
Name Type Description
v me.Vector2d
Source:
vector2.js, line 415
Returns:
angle in radians
Type
Number

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

Ceil the vector values
Source:
vector2.js, line 259
Returns:
new me.Vector2d
Type
me.Vector2d

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

Ceil this vector values
Source:
vector2.js, line 270
Returns:
Reference to this object for method chaining
Type
me.Vector2d

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

Clamp the vector value within the specified value range
Parameters:
Name Type Description
low Number
high Number
Source:
vector2.js, line 187
Returns:
new me.Vector2d
Type
me.Vector2d

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

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

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

return a clone copy of this vector
Source:
vector2.js, line 452
Returns:
new me.Vector2d
Type
me.Vector2d

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

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

<static> distance(v) → {Number}

return the distance between this vector and the passed one
Parameters:
Name Type Description
v me.Vector2d
Source:
vector2.js, line 402
Returns:
Type
Number

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

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

<static> dotProduct(v) → {Number}

return the dot product of this vector and the passed one
Parameters:
Name Type Description
v me.Vector2d
Source:
vector2.js, line 368
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.Vector2d
Source:
vector2.js, line 315
Returns:
Type
Boolean

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

Floor the vector values
Source:
vector2.js, line 237
Returns:
new me.Vector2d
Type
me.Vector2d

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

Floor this vector values
Source:
vector2.js, line 248
Returns:
Reference to this object for method chaining
Type
me.Vector2d

<static> length() → {Number}

return the length (magnitude) of this vector
Source:
vector2.js, line 391
Returns:
the length of this vector
Type
Number

<static> length2() → {Number}

return the square length of this vector
Source:
vector2.js, line 380
Returns:
The length^2 of this vector.
Type
Number

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

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

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

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

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

Negate the vector values
Source:
vector2.js, line 281
Returns:
new me.Vector2d
Type
me.Vector2d

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

Negate this vector values
Source:
vector2.js, line 292
Returns:
Reference to this object for method chaining
Type
me.Vector2d

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

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

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

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

<static> project(v) → {me.Vector2d}

project this vector on to another vector.
Parameters:
Name Type Description
v me.Vector2d The vector to project onto.
Source:
vector2.js, line 427
Returns:
Reference to this object for method chaining
Type
me.Vector2d

<static> projectN(v) → {me.Vector2d}

Project this vector onto a vector of unit length.
This is slightly more efficient than `project` when dealing with unit vectors.
Parameters:
Name Type Description
v me.Vector2d The unit vector to project onto.
Source:
vector2.js, line 439
Returns:
Reference to this object for method chaining
Type
me.Vector2d

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

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

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

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

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

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

<static> set(x, y) → {me.Vector2d}

set the Vector x and y properties to the given values
Parameters:
Name Type Description
x Number
y Number
Source:
vector2.js, line 33
Returns:
Reference to this object for method chaining
Type
me.Vector2d

<static> setV(v) → {me.Vector2d}

set the Vector x and y properties using the passed vector
Parameters:
Name Type Description
v me.Vector2d
Source:
vector2.js, line 81
Returns:
Reference to this object for method chaining
Type
me.Vector2d

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

set the Vector x and y properties to 0
Source:
vector2.js, line 70
Returns:
Reference to this object for method chaining
Type
me.Vector2d

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

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

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

Convert this vector into 2d coordinate space
Source:
vector2.js, line 141
Returns:
Reference to this object for method chaining
Type
me.Vector2d

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

Convert this vector into isometric coordinate space
Source:
vector2.js, line 130
Returns:
Reference to this object for method chaining
Type
me.Vector2d

<static> toString() → {String}

convert the object to a string representation
Source:
vector2.js, line 463
Returns:
Type
String
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-.