diff options
author | Philip Paquette <pcpaquette@gmail.com> | 2019-09-11 12:58:45 -0400 |
---|---|---|
committer | Philip Paquette <pcpaquette@gmail.com> | 2019-09-14 18:18:53 -0400 |
commit | abb42dcd4886705d6ba8af27f68ef605218ac67c (patch) | |
tree | 9ae16f7a09fff539fa72e65198e284bca6ac3376 /diplomacy/utils/equilateral_triangle.py | |
parent | a954a00d263750c279dbb2c0a9ae85707022bcd7 (diff) |
Added ReadtheDocs documentation for the public API
- Reformatted the docstring to be compatible
- Added tests to make sure the documentation compiles properly
- Added sphinx as a pip requirement
Co-authored-by: Philip Paquette <pcpaquette@gmail.com>
Co-authored-by: notoraptor <stevenbocco@gmail.com>
Diffstat (limited to 'diplomacy/utils/equilateral_triangle.py')
-rw-r--r-- | diplomacy/utils/equilateral_triangle.py | 25 |
1 files changed, 16 insertions, 9 deletions
diff --git a/diplomacy/utils/equilateral_triangle.py b/diplomacy/utils/equilateral_triangle.py index d31fe79..6535665 100644 --- a/diplomacy/utils/equilateral_triangle.py +++ b/diplomacy/utils/equilateral_triangle.py @@ -16,15 +16,17 @@ # ============================================================================== # pylint: disable=anomalous-backslash-in-string """ Helper class to compute intersection of a line (OM) with a side of an equilateral triangle, - with O the barycenter of the equilateral triangle and M a point outside the triangle. - A - / | M - / O | - C /______| B - - A = top, B = right, C = left - O = center of triangle - M = point outside of triangle + with O the barycenter of the equilateral triangle and M a point outside the triangle.:: + + A + / | M + / O | + C /______| B + + A = top, B = right, C = left + O = center of triangle + M = point outside of triangle + """ class EquilateralTriangle: """ Helper class that represent an equilateral triangle. @@ -53,6 +55,7 @@ class EquilateralTriangle: def __line_om(self, x_m, y_m): """ Returns the slope and the intersect of the line between O and M + :return: a, b - respectively the slope and the intercept of the line OM """ # pylint:disable=invalid-name @@ -62,6 +65,7 @@ class EquilateralTriangle: def _intersection_with_ab(self, x_m, y_m): """ Return coordinates of intersection of line (OM) with line (AB). + :param x_m: x coordinate of M :param y_m: y coordinate of M :return: coordinates (x, y) of intersection, or (None, None) if either @@ -85,6 +89,7 @@ class EquilateralTriangle: def _intersection_with_ac(self, x_m, y_m): """ Return coordinates of intersection of line (OM) with line (AC). + :param x_m: x coordinate of M :param y_m: y coordinate of M :return: coordinates (x, y) of intersection, or (None, None) if either @@ -107,6 +112,7 @@ class EquilateralTriangle: def _intersection_with_bc(self, x_m, y_m): """ Return coordinates of intersection of line (OM) with line (BC). NB: (BC) is an horizontal line. + :param x_m: x coordinate of M :param y_m: y coordinate of M :return: coordinates (x, y) of intersection, or (None, None) if either @@ -129,6 +135,7 @@ class EquilateralTriangle: """ Return coordinates of the intersection of (OM) with equilateral triangle, with M the point with coordinates (x_m, y_m). Only the intersection with the side of triangle near M is considered. + :param x_m: x coordinate of M :param y_m: y coordinate of M :return: a couple (x, y) of floating values. |