new Vector(x, y)
Parameters:
Name | Type | Description |
---|---|---|
x |
number | |
y |
number |
Members
-
x :number
-
Type:
- number
-
y :number
-
Type:
- number
Methods
-
<static> createVector2(vector)
-
Convert the specified vector the a olympe.df.Vector2
Parameters:
Name Type Description vector
olympe.utils.Vector Returns:
- Type
- olympe.df.Vector2
-
<static> fromVector2(vector)
-
Convert the Vector2 to a non dataflow vector with current values.
Parameters:
Name Type Description vector
olympe.df.PVector2 Returns:
- Type
- olympe.utils.Vector
-
add(vector)
-
Add another vector to this vector.
Parameters:
Name Type Description vector
olympe.utils.Vector Returns:
- Type
- olympe.utils.Vector
-
angleFrom(vector)
-
Calculate the angle, in radians, from north to another vector.
Parameters:
Name Type Description vector
olympe.utils.Vector Returns:
- Type
- number
-
clone()
-
Clones the current vector.
Returns:
- Type
- olympe.utils.Vector
-
distanceTo(otherPoint)
-
Returns the distance from this point to another point.
Parameters:
Name Type Description otherPoint
olympe.utils.Vector Returns:
- Type
- olympe.utils.Vector
-
divide(value)
-
Divide the current vector by a given value.
Parameters:
Name Type Description value
number The value to divide by.
Returns:
- Type
- olympe.utils.Vector
-
dotProduct(vector)
-
Return the dot product of the current vector and another vector.
Parameters:
Name Type Description vector
olympe.utils.Vector Returns:
- Type
- number
-
equalTo(vector)
-
Whether the vector is equal to another vector.
Parameters:
Name Type Description vector
olympe.utils.Vector Returns:
- Type
- boolean
-
getLength()
-
Get the length of the current vector.
Returns:
- Type
- number
-
limitTo(value)
-
Limit the length of the current vector to value without changing the direction in which the vector is pointing.
Parameters:
Name Type Description value
number The number to limit the current vector's length to.
Returns:
The current vector. useful for daisy-chaining calls.
- Type
- olympe.utils.Vector
-
maxComponent()
-
Get the value of the maximum component of the vector.
Returns:
- Type
- number
-
minComponent()
-
Get the value of the minimum component of the vector.
Returns:
- Type
- number
-
moveTowards(vector, amount)
-
Move the vector towards the given vector by the given amount.
Parameters:
Name Type Description vector
olympe.utils.Vector amount
number Returns:
- Type
- olympe.utils.Vector
-
multiply(value)
-
Multiply the current vector by a given value.
Parameters:
Name Type Description value
number | olympe.utils.Vector The number (or Vector) to multiply the current vector by.
Returns:
- Type
- olympe.utils.Vector
-
rotate(center, angle)
-
Parameters:
Name Type Description center
olympe.utils.Vector angle
number Returns:
- Type
- olympe.utils.Vector
-
subtract(vector)
-
Take another vector from this vector.
Parameters:
Name Type Description vector
olympe.utils.Vector Returns:
- Type
- olympe.utils.Vector
-
toString()
-
Returns a representation of the current vector as a string.
Returns:
- Type
- string
-
unitVector()
-
Get the unit vector of the current vector
Returns:
- Type
- olympe.utils.Vector