diff --git a/docs/geometry.rst b/docs/geometry.rst index 74b612f9..6b243f68 100644 --- a/docs/geometry.rst +++ b/docs/geometry.rst @@ -110,9 +110,9 @@ other objects. scale_ip: Scales the line by the given amount in place. - flip: Switches the endpoints of the line. + flip_ab: Switches the endpoints of the line. - flip_ip: Switches the endpoints of the line in place. + flip_ab_ip: Switches the endpoints of the line in place. update: Updates the line's attributes. diff --git a/docs/line.rst b/docs/line.rst index 91f54d9d..d3bc4e52 100644 --- a/docs/line.rst +++ b/docs/line.rst @@ -237,25 +237,25 @@ Line Methods .. ## Line.scale_ip ## - .. method:: flip + .. method:: flip_ab | :sl:`flips the line a and b points` - | :sg:`flip() -> Line` + | :sg:`flip_ab() -> Line` Returns a new `Line` that has the `a` and `b` points flipped. The original `Line` is not modified. - .. ## Line.flip ## + .. ## Line.flip_ab ## - .. method:: flip_ip + .. method:: flip_ab_ip | :sl:`flips the line a and b points, in place` - | :sg:`flip_ip() -> None` + | :sg:`flip_ab_ip() -> None` Flips the `Line`'s `b` and `b` points. The original `Line` is modified. Always returns None. - .. ## Line.flip_ip ## + .. ## Line.flip_ab_ip ## .. method:: is_parallel diff --git a/geometry.pyi b/geometry.pyi index 4eacc01f..0aaa1ce9 100644 --- a/geometry.pyi +++ b/geometry.pyi @@ -131,8 +131,8 @@ class Line(Sequence[float]): def scale(self, factor_and_origin: Sequence[float, float]) -> Line: ... @overload def scale_ip(self, factor_and_origin: Sequence[float, float]) -> None: ... - def flip(self) -> Line: ... - def flip_ip(self) -> None: ... + def flip_ab(self) -> Line: ... + def flip_ab_ip(self) -> None: ... def is_parallel(self, line: LineValue) -> bool: ... def is_perpendicular(self, line: LineValue) -> bool: ... def as_points(self, n_points: int) -> List[Tuple[float, float]]: ... diff --git a/src_c/line.c b/src_c/line.c index 163cd2ae..fc9f264d 100644 --- a/src_c/line.c +++ b/src_c/line.c @@ -479,7 +479,7 @@ pg_line_flip(pgLineObject *self, PyObject *_null) } static PyObject * -pg_line_flip_ip(pgLineObject *self, PyObject *_null) +pg_line_flip_ab_ip(pgLineObject *self, PyObject *_null) { double tx = self->line.x2; double ty = self->line.y2; @@ -754,8 +754,8 @@ static struct PyMethodDef pg_line_methods[] = { {"move", (PyCFunction)pg_line_move, METH_FASTCALL, NULL}, {"move_ip", (PyCFunction)pg_line_move_ip, METH_FASTCALL, NULL}, {"at", (PyCFunction)pg_line_at, METH_O, NULL}, - {"flip", (PyCFunction)pg_line_flip, METH_NOARGS, NULL}, - {"flip_ip", (PyCFunction)pg_line_flip_ip, METH_NOARGS, NULL}, + {"flip_ab", (PyCFunction)pg_line_flip, METH_NOARGS, NULL}, + {"flip_ab_ip", (PyCFunction)pg_line_flip_ab_ip, METH_NOARGS, NULL}, {"as_points", (PyCFunction)pg_line_as_points, METH_O, NULL}, {"as_segments", (PyCFunction)pg_line_as_segments, METH_O, NULL}, {"scale", (PyCFunction)pg_line_scale, METH_FASTCALL, NULL}, diff --git a/test/test_line.py b/test/test_line.py index eaddaa91..8bcaa1cd 100644 --- a/test/test_line.py +++ b/test/test_line.py @@ -725,7 +725,7 @@ def test_meth_scale_ip(self): def test_meth_flip(self): line = Line(1.1, 2.2, 3.3, 4.4) - ret = line.flip() + ret = line.flip_ab() self.assertIsInstance(ret, Line) self.assertEqual(ret.x1, 3.3) @@ -734,12 +734,12 @@ def test_meth_flip(self): self.assertEqual(ret.y2, 2.2) with self.assertRaises(TypeError): - line.flip(1) + line.flip_ab(1) - def test_meth_flip_ip(self): + def test_meth_flip_ab_ip(self): line = Line(1.1, 2.2, 3.3, 4.4) - line.flip_ip() + line.flip_ab_ip() self.assertEqual(line.x1, 3.3) self.assertEqual(line.y1, 4.4) @@ -747,7 +747,7 @@ def test_meth_flip_ip(self): self.assertEqual(line.y2, 2.2) with self.assertRaises(TypeError): - line.flip_ip(1) + line.flip_ab_ip(1) def test_meth_collidepoint(self): A = Line(0, 0, 1, 1)