Skip to content

Commit ea76d39

Browse files
committed
made the docs more clear, improved the images
1 parent 193071a commit ea76d39

File tree

8 files changed

+12
-14
lines changed

8 files changed

+12
-14
lines changed

buildconfig/stubs/pygame/geometry.pyi

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,4 +197,6 @@ class Line:
197197
def scale_ip(self, factor_and_origin: Point, /) -> None: ...
198198
def flip_ab(self) -> Line: ...
199199
def flip_ab_ip(self) -> None: ...
200-
def project(self, point: Point, do_clamp: bool = False) -> Point: ...
200+
def project(
201+
self, point: tuple[float, float], clamp: bool = False
202+
) -> tuple[float, float]: ...
14.2 KB
Loading
-3.39 KB
Binary file not shown.
-3.92 KB
Binary file not shown.
-4.38 KB
Binary file not shown.
30.2 KB
Loading

docs/reST/ref/geometry.rst

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -744,26 +744,22 @@
744744
.. method:: project
745745

746746
| :sl:`projects the line onto the given line`
747-
| :sg:`project(point, do_clamp=False) -> point`
747+
| :sg:`project(point: tuple[float, float], clamp=False) -> tuple[float, float]`
748748
749-
Returns a new point(tuple[float, float]) that is projected onto the line like so
749+
This method takes in a point and one boolean keyword argument clamp. It outputs an orthogonally projected point onto the line.
750+
If clamp is True it makes sure that the outputted point will be on the line segment.
750751

751-
.. figure:: code_examples/project1.png
752-
:alt: project method image
753-
754-
Example of what project method does if you input the green point you get back the yellow one.
755752

753+
.. figure:: code_examples/project.png
754+
:alt: project method image
756755

757-
.. figure:: code_examples/project2.png
758-
:alt: project do_clamp=False image
759-
760-
Example of what the do_clamp argument does when it is False
756+
Example of how it projects the point on to the line purplish point is the point we want to project and the blue point is what you would get as a result
761757

762758

763-
.. figure:: code_examples/project1.png
759+
.. figure:: code_examples/project_clamp.png
764760
:alt: project do_clamp=True image
765761

766-
Example of what the do_clamp argument does when it is True
762+
Example of what the clamp argument changes if it is true it stays on the line segment
767763

768764
.. versionadded:: 2.5.4
769765

src_c/doc/geometry_doc.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,4 +45,4 @@
4545
#define DOC_LINE_SCALEIP "scale_ip(factor, origin) -> None\nscale_ip(factor_and_origin) -> None\nscales the line by the given factor from the given origin in place"
4646
#define DOC_LINE_FLIPAB "flip_ab() -> Line\nflips the line a and b points"
4747
#define DOC_LINE_FLIPABIP "flip_ab_ip() -> None\nflips the line a and b points, in place"
48-
#define DOC_LINE_PROJECT "project(point, do_clamp=False) -> point\nprojects the line onto the given line"
48+
#define DOC_LINE_PROJECT "project(point: tuple[float, float], clamp=False) -> tuple[float, float]\nprojects the line onto the given line"

0 commit comments

Comments
 (0)