The plugin is now on the fast lasso-local write path for ordinary single-shape replacements, which removed the earlier full-page blanking behavior.
The active algorithm is a resampled, corner-first matcher with:
- spatial resampling
- stroke stitching
- closing-tail trimming
- fast non-shape rejection
- curve fitting for circle and ellipse
- polygon fitting with special handling for rectangles and open triangles
- post-fit orientation snapping for near-horizontal and near-vertical geometry
The current working benchmark set uses two real exported Supernote fixtures:
The first page contains 10 isolated hand-drawn shapes and remains the broad “works well enough to trust” page. The second page is the rectangle-heavy regression page that exposed the new triangle override bug.
Expected labels for the first page:
- rectangle
- rectangle
- circle
- ellipse
- ellipse
- triangle
- ellipse
- pentagon
- ellipse
- rectangle
Additional locked expectations from the second page:
- element 2 -> triangle
- elements 3, 4, 5 -> rectangle
- element 9 -> pentagon
This one page concentrates the failure modes that mattered most in real use:
- rough but intended rectangles
- near-circle vs ellipse ambiguity
- retraced or open triangles
- polygon side-count drift
- elongated ovals that should not get misread as polygons
The matcher is being tuned with these priorities:
- Keep no-match fast and local.
- Avoid false polygon snaps on smooth curves.
- Recover ordinary notebook triangles and rectangles even when they are not perfectly closed.
- Apply weak family priors only within sibling families, especially circle vs ellipse and square vs rectangle.
Recent matcher improvement:
- closed triangles with one weak extra corner now get a reduced-triangle fallback instead of immediately collapsing into rectangle or higher-sided polygon interpretations
- reduced-triangle recovery is now blocked when the same contour already has strong multi-source quadrilateral evidence, which prevents rounded rectangles from collapsing into triangles
The write path is also being tightened around two Supernote-specific constraints:
- recognized notes may reject layer APIs, so layer preservation must be best-effort rather than mandatory
GEO_polygongeometry should be emitted as an explicitly closed point ring so the final edge is drawn reliably on device
The orientation policy is now explicit too:
- if a final line, polygon edge, or ellipse axis is within 10 degrees of horizontal, snap it to horizontal
- otherwise, if one is within 10 degrees of vertical, snap it to vertical
- horizontal wins when both are plausible
- The benchmark page is strong enough for iteration but not broad enough for final confidence.
- Shape 7 on the sample page is still the softest semantic case. It currently remains in the ellipse family, which is acceptable for now because it is clearly not a polygon and still reads as intentional geometry.
- Broader validation still needs more exported samples, especially negatives and multi-stroke shapes.
- Unsupported “house” or other irregular 5-sided shapes still need a dedicated regular-polygon strictness pass. That should be handled separately from triangle recovery so the real pentagon benchmark does not regress.
- Add an actual toolbar/sidebar settings surface. It has not been implemented yet, despite earlier discussion.
- Keep tuning triangle recovery on broader real samples now that the rectangle regression from
20260409_191519is covered by tests. - Tighten the no-match path for unsupported irregular 5-sided shapes so “house” drawings do not snap to pentagons.
- Investigate why the
20260409_191519note export produced duplicated page payloads.
After the sample page is stable, the next benchmark set should add:
- more negative examples labeled
none - multi-stroke shapes
- larger and smaller versions of the same shape
- intentionally rough squares, rectangles, and triangles
- more 5-8 sided polygons