Skip to content

Method Proposal: pygame.geometry.Line.closest_point(point, do_clamp=True) #3019

Open
@damusss

Description

@damusss

The Line object has not been ported yet, but for the time it will, I propose to add the method in the title.

The method returns the closest point on the line relative to another point. The math for it isn't super straight forward, and unless you studied that somehow you probably need to search it online, that's why I think it should be added.

The do_clamp parameter controls weather the endpoints are ignored. The "default" math returns a point that can exceed A and B, but this could be what the user wants, so it could be optionally clamped.

Metadata

Metadata

Assignees

No one assigned

    Labels

    New APIThis pull request may need extra debate as it adds a new class or function to pygameenhancementgeometrypygame.geometry

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions