From 01227b3382b62650fe409761e31e1f52dfacdd24 Mon Sep 17 00:00:00 2001 From: Esa Kataja Date: Tue, 28 Jul 2026 22:22:03 +0300 Subject: [PATCH] Model cuts as polylines, not horizontal lines MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Page 1 of Engel (Bosse/Partitura) has a boxed VERSE 1 label in the left margin at the same rows as the preceding system's bass lyric line — ink on both sides of the page throughout the band, so no horizontal line separates them. The label belongs to system 2, the lyrics to system 1. A cut is therefore a polyline spanning the page, two points being the ordinary straight case. A slice bounded by a non-straight cut is not rectangular: its image is the region's bounding box with everything outside made transparent, which composites invisibly on the viewer's sheet. Masking paints transparency, never white. --- CONTEXT.md | 23 +++++++++++++++-------- docs/spec.md | 17 ++++++++++++++++- 2 files changed, 31 insertions(+), 9 deletions(-) diff --git a/CONTEXT.md b/CONTEXT.md index a82232c..c4ce60e 100644 --- a/CONTEXT.md +++ b/CONTEXT.md @@ -20,9 +20,11 @@ _Avoid_: mode, format **Slice**: The atomic visual unit of a song — one *system*, one full line of music across all voices, typically 4–12 bars with lyrics intact. Same definition as noteman's. -Structurally, a horizontal region of a page: a page begins as a single slice and -each cut splits one slice into two, so slices always tile the page with no gaps -and no overlap. +Structurally, a region of a page bounded above and below by cuts: a page begins +as a single slice and each cut splits one slice into two, so slices always tile +the page with no gaps and no overlap. Rectangular when its cuts are straight, +and stepped when they are not — the slice image is then its bounding box with +everything outside the region transparent. _Avoid_: segment, strip, row, band **Discard**: @@ -76,11 +78,16 @@ living unenforced in two repos, and a score with two codas simply works. _Avoid_: link, reference, pointer **Cut**: -A horizontal line placed on a page that splits one slice into two. Straight at -first; a later polyline form handles pages where systems slant or interleave. -Placement is forgiving — anywhere inside the whitespace gap yields the same -output, because trim crops to ink afterwards. -_Avoid_: split, divider, break +A boundary placed on a page that splits one slice into two. Modelled as a +**polyline** spanning the page from left edge to right edge, with two points — +a straight horizontal line — as the ordinary case. Extra vertices handle the +common publisher habit of printing a section label (`VERSE 1`, `INTRO`) in the +left margin at the same height as the previous system's lyrics: the cut steps +above the label on the left and below the lyrics on the right. + +Placement along the boundary is forgiving — anywhere inside the whitespace yields +the same output, because trim crops to ink afterwards. +_Avoid_: split, divider, break, cut line **Content rectangle**: The region of a page that holds music. Set per PDF, adjustable per page, applied diff --git a/docs/spec.md b/docs/spec.md index 62586e2..d074de6 100644 --- a/docs/spec.md +++ b/docs/spec.md @@ -89,9 +89,24 @@ cuts at the page edges. Modelling a slice as "the region between two cuts" leaks page 2 has no header, so it would need an invented top cut whose position depends on whether that page happens to have one. -Cut placement is forgiving — anywhere inside the whitespace gap yields the same +Cut placement is forgiving — anywhere inside the whitespace yields the same output, because trim crops to ink afterwards. +**A cut is a polyline, not a line.** Two points — a straight horizontal +boundary — is the ordinary case and what detection proposes. Extra vertices exist +because publishers routinely print a section label in the left margin at the same +height as the *previous* system's lyrics. On page 1 of *Engel* (Bosse/Partitura +edition), the boxed `VERSE 1` label and the preceding system's bass lyric line +occupy the same rows: ink is present on both sides of the page throughout that +band, so no horizontal line separates them. `VERSE 1` belongs to system 2, the +lyrics to system 1. The cut has to step — above the label on the left, below the +lyrics on the right. + +A slice bounded by a non-straight cut is **not rectangular**. Its image is the +bounding box of the region, with everything outside the region made transparent. +That composites invisibly on the viewer's sheet, so nothing downstream needs to +know. This is also why masking must paint transparency rather than white. + ### Content rectangle The region of a page that holds music, set per PDF and adjustable per page,