new Vector2(x, y)
Creates new vector2;
Parameters:
Name | Type | Description |
---|---|---|
x |
Number | |
y |
Number |
- Source:
Methods
add(x, y) → {Ayce.Vector2}
Adds values to vector
Parameters:
Name | Type | Description |
---|---|---|
x |
Number | |
y |
Number |
- Source:
Returns:
vector
- Type
- Ayce.Vector2
addVector2(v) → {Ayce.Vector2}
Adds vector
Parameters:
Name | Type | Description |
---|---|---|
v |
Ayce.Vector2 |
- Source:
Returns:
vector
- Type
- Ayce.Vector2
copy() → {Ayce.Vector2}
Returns copy of vector
- Source:
Returns:
vector
- Type
- Ayce.Vector2
copyToVector(from, to)
Copies values from one vector to another
Parameters:
Name | Type | Description |
---|---|---|
from |
Ayce.Vector2 | |
to |
Ayce.Vector2 |
- Source:
distance(pt1, pt2) → {Number}
Returns distance between two points
Parameters:
Name | Type | Description |
---|---|---|
pt1 |
Ayce.Vector2 | |
pt2 |
Ayce.Vector2 |
- Source:
Returns:
distance
- Type
- Number
dotProduct(a) → {Number}
Returns dot product
Parameters:
Name | Type | Description |
---|---|---|
a |
Ayce.Vector2 |
- Source:
Returns:
product
- Type
- Number
getLength() → {Number}
Returns length of vector
- Source:
Returns:
length
- Type
- Number
multiply(x, y) → {Ayce.Vector2}
Multiplies vector by values
Parameters:
Name | Type | Description |
---|---|---|
x |
Number | |
y |
Number |
- Source:
Returns:
vector
- Type
- Ayce.Vector2
negate() → {Ayce.Vector2}
Negates vector
- Source:
Returns:
Ayce.Vector2
- Type
- Ayce.Vector2
normalize() → {Ayce.Vector2}
Converts vector to unit vector
- Source:
Returns:
vector
- Type
- Ayce.Vector2
nullVector() → {Ayce.Vector2}
Sets Vector to (0, 0, 0)
- Source:
Returns:
vector
- Type
- Ayce.Vector2
scaleBy(s) → {Ayce.Vector2}
Scales vector by given factor
Parameters:
Name | Type | Description |
---|---|---|
s |
Number |
- Source:
Returns:
vector
- Type
- Ayce.Vector2
set(x, y) → {Ayce.Vector2}
Sets vector to given values
Parameters:
Name | Type | Description |
---|---|---|
x |
Number | |
y |
Number |
- Source:
Returns:
vector
- Type
- Ayce.Vector2
subtract(x, y) → {Ayce.Vector2}
Subtracts values off of vector
Parameters:
Name | Type | Description |
---|---|---|
x |
Number | |
y |
Number |
- Source:
Returns:
vector
- Type
- Ayce.Vector2