lilypond-devel
[Top][All Lists]

## Re: issue 5312: Key cancellation glyph position inconsistent (issue 3430

 From: Torsten Hämmerle Subject: Re: issue 5312: Key cancellation glyph position inconsistent (issue 343020043 by address@hidden) Date: Thu, 26 Apr 2018 03:13:23 -0700 (MST)

```Noeck wrote
> I've confidence in your algorithm. I just thought I post a situation
> which I would have neglected at first – without knowing what your
> algorithm does.

Hi Joram,

It's good have asked, it is just too easy to overlook things...

Noeck wrote
> Thanks for your explanation! It seems pretty robust and straightforward
> to me, now. Are the two algorithms the equivalent if you make the green
> line of the old algo ½ a staff space longer and add the "just touching"
> case?

(additional interval length marked in light green), including two custom
cases that don't occur in standard key signatures.

<http://lilypond.1069038.n5.nabble.com/file/t3887/key_cancellation_intervals_joram.png>

*Why I didn't do it that way:*
Technically, even the "points" in the original algorithm were intervals,
e.g. a point at y = 5 was represented by the interval [5:5].
We use integer intervals (called "Slices" for an unknown reason) and in
order to get a finer resolution (half space), /every/ value assignment
changes, anyway.

But the main reason was the way to check the "touching" case:
If there's an intersection, it's easy to distinguish between "touching"
(intersection length 0) and "overlapping" (intersection length > 0).
Compared to this, a mere point (i.e. zero-length interval) will always yield
a zero length intersection even in the midst of the other interval and we
need to compare distances...

All in all, I considered it much more straightforward to represent the
neighboring edges as what they really are: intervals of a certain length
that either intersect, touch, or don't intersect at all.

And the original point solution had the same technical complexity, as the
"point" was nothing but another interval, albeit of zero length.

Noeck wrote
> One more question: How do you produce those images? They look too
> perfect to be drawn by hand (Inkscape etc.) but they're also too far
> from music notation that I would want to produce them via LilyPond.

I hardly dare to admit it, but all I used was Windows' infamous Paint
program (a simple raster graphics editor).
As a basis, I used a LilyPond screenshot, moved things around and inserted
pixel based elements.

All the best and thanks for your interest,
Torsten

--
Sent from: http://lilypond.1069038.n5.nabble.com/Dev-f88644.html

```