From 1fbaa77d75f4e96500a6543c99c59bb24c081acf Mon Sep 17 00:00:00 2001 From: grunkgrunk Date: Sun, 5 Nov 2017 16:00:37 +0100 Subject: [PATCH 1/2] moved lua-comments in docs down to the same line as the code. --- docs/vector-light.rst | 18 +++++++----------- docs/vector.rst | 16 ++++++---------- 2 files changed, 13 insertions(+), 21 deletions(-) diff --git a/docs/vector-light.rst b/docs/vector-light.rst index 7c9da56..fdcd82f 100644 --- a/docs/vector-light.rst +++ b/docs/vector-light.rst @@ -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) diff --git a/docs/vector.rst b/docs/vector.rst index 6e5e509..f2e4f78 100644 --- a/docs/vector.rst +++ b/docs/vector.rst @@ -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) From 0a6c4ec482dc718bdf757b934275098964037e1a Mon Sep 17 00:00:00 2001 From: Matthias Richter Date: Sun, 19 Nov 2017 21:02:35 +0100 Subject: [PATCH 2/2] Consistent doc --- docs/vector-light.rst | 14 ++++++++------ docs/vector.rst | 12 +++++++----- 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/docs/vector-light.rst b/docs/vector-light.rst index fdcd82f..aa681dc 100644 --- a/docs/vector-light.rst +++ b/docs/vector-light.rst @@ -65,7 +65,7 @@ Useful for debugging. .. function:: vector.fromPolar(angle, radius) :param number angle: Angle of the vector in radians. - :param number radius: Length of the vector. + :param number radius: Length of the vector (optional, default = 1). :returns: ``x``, ``y``: The vector in cartesian coordinates. @@ -94,14 +94,16 @@ 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 (optional, default = 1). + :param number len_max: Maximum length of the vector (optional, default = ``len_min``). + :returns: ``x``, ``y``: A vector pointing in a random direction with a random length between ``len_min`` and ``len_max``. + +Sample a vector with random direction and (optional) length. **Examples**:: - 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(1,5) -- length is a random value between 1 and 5 x,y = vector.randomDirection(100) -- length is 100 @@ -429,7 +431,7 @@ i.e. the function returns the angle to the coordinate system. .. function:: vector.trim(max_length, x,y) :param number max_length: Maximum allowed length of the vector. - :param numbers x,y: Vector to trum. + :param numbers x,y: Vector to trim. :returns: The trimmed vector. Trim the vector to ``max_length``, i.e. return a vector that points in the same diff --git a/docs/vector.rst b/docs/vector.rst index 49eca54..2d1b700 100644 --- a/docs/vector.rst +++ b/docs/vector.rst @@ -103,7 +103,7 @@ Create a new vector. .. function:: vector.fromPolar(angle, radius) :param number angle: Angle of the vector in radians. - :param number radius: Length of the vector. + :param number radius: Length of the vector (optional, default = 1). :returns: The vector in cartesian coordinates. @@ -116,15 +116,17 @@ 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 (optional, default = 1). + :param number len_max: Maximum length of the vector (optional, default = ``len_min``). + :returns: A vector pointing in a random direction with a random length between ``len_min`` and ``len_max``. **Examples**:: - 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 + rnd = vector.randomDirection(1,5) -- length is a random value between 1 and 5 + +Sample a vector with random direction and (optional) length. .. function:: vector.isvector(v)