Skip to content

Add Point in Polygon algorithm using ray casting - #15309

Open
Clear20-22 wants to merge 5 commits into
TheAlgorithms:masterfrom
Clear20-22:add-point-in-polygon
Open

Add Point in Polygon algorithm using ray casting#15309
Clear20-22 wants to merge 5 commits into
TheAlgorithms:masterfrom
Clear20-22:add-point-in-polygon

Conversation

@Clear20-22

Copy link
Copy Markdown
Contributor

Describe your change:

  • Add an algorithm?
  • Fix a bug or typo in an existing algorithm?
  • Documentation change?

References

Checklist:

  • I have read CONTRIBUTING.md.
  • This pull request is all my own work -- I have not plagiarized.
  • I know that pull requests will not be merged if they fail the automated tests.
  • This PR only changes one algorithm file. To ease review, please open separate PRs for separate algorithms.
  • All new Python files are placed inside an existing directory.
  • All filenames are in all lowercase characters with no spaces or dashes.
  • All functions and variable names follow Python naming conventions.
  • All function parameters and return values are annotated with Python type hints.
  • All functions have doctests that pass the automated testing.
  • All new algorithms include at least one URL that points to Wikipedia or another similar explanation.
  • If this pull request resolves one or more open issues then the commit message contains Fixes: #{$ISSUE_NO}.

Copilot AI lite review requested due to automatic review settings September 13, 2026 03:58
@algorithms-keeper algorithms-keeper Bot added the awaiting reviews This PR is ready to be reviewed label Sep 13, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The fixed boundary tolerance causes inconsistent near-boundary classifications and needs explicit, scale-aware, or exact handling.

Get a fresh assessment by requesting another Copilot review.

Pull request overview

Adds a ray-casting point-in-polygon algorithm with boundary handling and doctests.

Changes:

  • Adds a reusable Point type and boundary helper.
  • Implements polygon validation and even–odd ray casting.
  • Documents behavior with references and doctests.
File summaries
File Description
geometry/point_in_polygon.py Adds the point-in-polygon implementation and doctests.
Review details
  • Files reviewed: 1/1 changed files
  • Comments generated: 1
  • Review effort level: Lite

💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread geometry/point_in_polygon.py Outdated
Comment on lines +161 to +162
if is_point_on_segment(point, edge_start, edge_end):
return include_boundary
@cclauss

cclauss commented Sep 13, 2026

Copy link
Copy Markdown
Member

ON HOLD: Our focus is on merging or closing old pull requests before October 1st.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

awaiting reviews This PR is ready to be reviewed on hold

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants