Skip to content

Update soccer.py#39

Open
catsmells wants to merge 1 commit intoroboflow:mainfrom
catsmells:patch-1
Open

Update soccer.py#39
catsmells wants to merge 1 commit intoroboflow:mainfrom
catsmells:patch-1

Conversation

@catsmells
Copy link

Description

Refactored soccer pitch drawing code to improve modularity, performance, and reliability by splitting functions, adding input validation, optimizing Voronoi calculations, enhancing error handling, and improving docstrings. No specific issue fixed; changes driven by code quality improvement (inspired by Roboflow's sports repo: https://github.com/roboflow/sports). Dependencies: numpy, opencv-python, supervision.

Type of change

  • This change requires a documentation update

How has this change been tested, please provide a testcase or example of how you tested the change?

Tested by running draw_pitch, draw_points_on_pitch, draw_paths_on_pitch, and draw_pitch_voronoi_diagram with sample SoccerPitchConfiguration and synthetic xy data (e.g., np.array([[10, 20], [30, 40]]) for points, paths with 2+ points). Verified output images for correct pitch rendering, point/path placement, and Voronoi diagram accuracy using OpenCV's cv2.imshow.

Any specific deployment considerations

None; changes are backward-compatible and require no new secrets or costs.

Docs

  • Docs updated? What were the changes:
    Updated docstrings in all functions (draw_pitch, draw_points_on_pitch, draw_paths_on_pitch, draw_pitch_voronoi_diagram) to clarify parameter descriptions, specify array shapes (e.g., xy as (n, 2)), detail return value formats (np.ndarray, shape, dtype), and include exception information.

Split functions into smaller, reusable ones, added input validation, optimized Voronoi calculations, improved error handling, and enhanced docstrings for better readability and maintenance.
@catsmells
Copy link
Author

I have read the CLA Document and I sign the CLA.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant