mirror of
https://github.com/vrld/hump.git
synced 2024-11-23 12:24:19 +00:00
Merge branch 'randvector-docs' of https://github.com/grunkgrunk/hump into grunkgrunk-randvector-docs
This commit is contained in:
commit
9a8e16a55f
@ -94,19 +94,15 @@ Convert the vector to polar coordinates, i.e., the angle and the radius/lenth.
|
||||
|
||||
.. function:: vector.randomDirection(len_min, len_max)
|
||||
|
||||
:param number len_min: Minimum length of the vector.
|
||||
:param number len_max: Maximum length of the vector.
|
||||
:returns: ``x``, ``y``: A vector pointing in a random direction with a random length between len_min and len_max.
|
||||
:param number len_min: Minimum length of the vector.
|
||||
:param number len_max: Maximum length of the vector.
|
||||
:returns: ``x``, ``y``: A vector pointing in a random direction with a random length between len_min and len_max.
|
||||
|
||||
**Examples**::
|
||||
-- length is a random value between 1 and 5
|
||||
x,y = vector.randomDirection(1,5)
|
||||
|
||||
-- length is 1
|
||||
x,y = vector.randomDirection()
|
||||
|
||||
-- length is 100
|
||||
x,y = vector.randomDirection(100)
|
||||
|
||||
x,y = vector.randomDirection(1,5) -- length is a random value between 1 and 5
|
||||
x,y = vector.randomDirection() -- length is 1
|
||||
x,y = vector.randomDirection(100) -- length is 100
|
||||
|
||||
|
||||
.. function:: vector.mul(s, x,y)
|
||||
|
@ -116,19 +116,15 @@ The ``angle`` is measured against the vector (1,0), i.e., the x axis.
|
||||
|
||||
.. function:: vector.randomDirection(len_min, len_max)
|
||||
|
||||
:param number len_min: Minimum length of the vector.
|
||||
:param number len_max: Maximum length of the vector.
|
||||
:returns: A vector pointing in a random direction with a random length between len_min and len_max.
|
||||
:param number len_min: Minimum length of the vector.
|
||||
:param number len_max: Maximum length of the vector.
|
||||
:returns: A vector pointing in a random direction with a random length between len_min and len_max.
|
||||
|
||||
**Examples**::
|
||||
-- length is a random value between 1 and 5
|
||||
rnd = vector.randomDirection(1,5)
|
||||
|
||||
-- length is 1
|
||||
rnd = vector.randomDirection()
|
||||
|
||||
-- length is 100
|
||||
rnd = vector.randomDirection(100)
|
||||
rnd = vector.randomDirection(1,5) -- length is a random value between 1 and 5
|
||||
rnd = vector.randomDirection() -- length is 1
|
||||
rnd = vector.randomDirection(100) -- length is 100
|
||||
|
||||
.. function:: vector.isvector(v)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user