perf: Batch point-in-polygon with matplotlib.path.Path #25

Closed
opened 2026-06-10 05:45:54 +00:00 by Mark · 0 comments
Owner

Problem

underlay_generator.py:232-276 — _is_point_in_polygon is O(v) per stitch. Called for every stitch on every contour line.

Proposed Fix

Use matplotlib.path.Path.contains_points for batch point-in-polygon testing.

Impact

5-20x faster for complex polygons.

Files

  • src/embroidery_converter/underlay_generator.py:232-276
## Problem `underlay_generator.py:232-276` — `_is_point_in_polygon` is O(v) per stitch. Called for every stitch on every contour line. ## Proposed Fix Use `matplotlib.path.Path.contains_points` for batch point-in-polygon testing. ## Impact 5-20x faster for complex polygons. ## Files - `src/embroidery_converter/underlay_generator.py:232-276`
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Mark/easystitch#25
No description provided.