Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chip away some refactors in geometry.py #46

Merged
merged 3 commits into from
Oct 17, 2024
Merged

Conversation

jGaboardi
Copy link
Collaborator

This PR:

  • chips way some refactoring in geometry.py
  • DRYs out geometry.snap_to_targets() & breaks out some helper funds
  • add dedicated granular test for helpers
  • xref testing, refactor, & docstrings #20

Copy link

codecov bot commented Oct 17, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 98.1%. Comparing base (32d1f0c) to head (2777b44).
Report is 1 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@          Coverage Diff          @@
##            main     #46   +/-   ##
=====================================
  Coverage   98.1%   98.1%           
=====================================
  Files          6       6           
  Lines        880     891   +11     
=====================================
+ Hits         863     874   +11     
  Misses        17      17           
Files with missing lines Coverage Δ
sgeop/geometry.py 100.0% <100.0%> (ø)

@@ -236,7 +237,7 @@ def voronoi_skeleton(
if edgelines.shape[0] > 0:
# if there is no explicit snapping target, snap to the boundary of the polygon
# via the shortest line. That is by definition always within the polygon
# (Martin thinks)
# (Martin thinks) (James concurs)
Copy link
Contributor

Choose a reason for hiding this comment

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

❤️

Comment on lines 404 to 406
def _last_point(line: shapely.LineString) -> shapely.Point:
"""Helper for returning final point on a line."""
return shapely.get_point(line, -1)
Copy link
Contributor

Choose a reason for hiding this comment

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

I'd probably prefer using shapely.get_point(line, -1) and it is explicit

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I've got no problem with that. I'll dump that helper and remove from testing.

@jGaboardi jGaboardi merged commit 89f6f8b into main Oct 17, 2024
10 checks passed
@jGaboardi jGaboardi deleted the GL20_geometry_tests branch October 17, 2024 14:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants