[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: What to do wanting a 4th order Bézier?
From: |
Urs Liska |
Subject: |
Re: What to do wanting a 4th order Bézier? |
Date: |
Sun, 18 Sep 2016 16:01:53 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.3.0 |
Am 18.09.2016 um 15:49 schrieb Urs Liska:
>
> Am 18.09.2016 um 15:38 schrieb Simon Albrecht:
>> On 18.09.2016 15:15, Kieren MacMillan wrote:
>>>> And finally with a better user interface
>>> Under what circumstances would you NOT want the end of one curve to
>>> match precisely the beginning of the next one?
>>> If “none”, then I would say an even better user interface would not
>>> require typing that set of coordinates twice.
>> I thought about that too – it also makes the data structure less
>> complicated if it’s a list of seven pairs. I added the new version to
>> the LSR <http://lsr.di.unimi.it/LSR/Item?id=1045>, awaiting approval.
> There's another improvement I'm right now experimenting with: Not having
> to type the second control point of the second spline but calculating
> that mirroring it from the third one of the first spline. I noticed that
> the compound slur had a noticeable angle there, so this improvement will
> not only require one point less to type (and determine) but also ensure
> a smooth turning point.
%%%%%%%%%%%%%%%%%%%%%%%%
\version "2.19.47"
\language "deutsch"
#(define (make-cross-stencil coord)
"Draw a cross-stencil at coord."
(let ((thick 0.1)
(sz 0.2))
(stencil-with-color
(ly:stencil-add
(make-line-stencil
thick
(- (car coord) sz)
(- (cdr coord) sz)
(+ (car coord) sz)
(+ (cdr coord) sz))
(make-line-stencil
thick
(- (car coord) sz)
(+ (cdr coord) sz)
(+ (car coord) sz)
(- (cdr coord) sz)))
cyan)
))
#(define (mirror-point pt1 pt2)
"Mirror pt2 against pt1"
(cons
(- (* 2 (car pt1)) (car pt2))
(- (* 2 (cdr pt1)) (cdr pt2))))
compoundSlur =
#(define-event-function (contr-pts ann?) (list? boolean?)
(let ((proc (lambda (grob)
(let* (;; only here for reference:
(cps (ly:slur::calc-control-points grob))
(cps1 (first contr-pts))
(cps2 (second contr-pts))
(cp2-2 (mirror-point (fourth cps1) (third cps1)))
(cps2 `(,(fourth cps1) ,cp2-2 ,@cps2))
(first-spline-stil
(begin
(ly:grob-set-property! grob 'control-points
cps1)
(ly:slur::print grob)))
(second-spline-stil
(begin
(ly:grob-set-property! grob 'control-points
cps2)
(ly:slur::print grob)))
;; annotates all new control-points
(crosses
(if ann?
(apply
ly:stencil-add
(map
(lambda (c)
(make-cross-stencil c))
(append cps1 cps2)))
empty-stencil))
)
(display cps2)(newline)
;(pretty-print cps)
;; returns
;; ((0.631380973009261 . 7.545004)
;; (3.65053718406404 . 9.82511349243875)
;; (53.1972252988833 . 16.0566485774538)
;; (56.6869647738747 . 14.5951692170292))
(ly:stencil-add
first-spline-stil
second-spline-stil
crosses
)))))
#{ -\tweak stencil $proc ( #}))
cptsA = #'(((0.6 . 5.8)
(2 . 9)
(26.0 . 5.0)
(32 . 12))
((53.1 . 16.0)
(55.5 . 12.5)))
upper = \relative {
\key d \major
\clef bass
s2 r8 d,16 g h d g h
d8 r s2.
s4 \voiceTwo h8.(-- c16-- h2--)
}
lower = \relative {
\key d \major
\clef bass
r2
<d' h g=>~-^-\compoundSlur \cptsA ##t
<<
{
<d h g>4 <c g e> <h g> \voiceOne cis
\change Staff = upper
\clef treble \voiceOne d e fis2)
\fermata
}
\new Voice {
\voiceTwo
s2. <g,= e>4 \oneVoice
<fis h,> <g e> <fis dis>2\fermata
}
>>
}
\score {
<<
\new PianoStaff <<
\new Staff = upper \upper
\new Staff = lower \lower
>>
>>
}
%%%%%%%%%%%%%%%%%%%%%%%
>
> After that I would like to suggest looking for a solution that will
> enable passing the control points as offsets against the default
> (non-compound) slur, like \shape does.
>
> Urs
>
>> Best, Simon
>>
>> _______________________________________________
>> lilypond-user mailing list
>> address@hidden
>> https://lists.gnu.org/mailman/listinfo/lilypond-user
>
> _______________________________________________
> lilypond-user mailing list
> address@hidden
> https://lists.gnu.org/mailman/listinfo/lilypond-user
- Re: What to do wanting a 4th order Bézier?, (continued)
- Re: What to do wanting a 4th order Bézier?, Kieren MacMillan, 2016/09/17
- Re: What to do wanting a 4th order Bézier?, Thomas Morley, 2016/09/17
- Re: What to do wanting a 4th order Bézier?, Simon Albrecht, 2016/09/17
- Re: What to do wanting a 4th order Bézier?, Thomas Morley, 2016/09/17
- Re: What to do wanting a 4th order Bézier?, Simon Albrecht, 2016/09/17
- Re: What to do wanting a 4th order Bézier?, Urs Liska, 2016/09/17
- Re: What to do wanting a 4th order Bézier?, Thomas Morley, 2016/09/17
- Re: What to do wanting a 4th order Bézier?, Kieren MacMillan, 2016/09/18
- Re: What to do wanting a 4th order Bézier?, Simon Albrecht, 2016/09/18
- Re: What to do wanting a 4th order Bézier?, Urs Liska, 2016/09/18
- Re: What to do wanting a 4th order Bézier?,
Urs Liska <=
- Re: What to do wanting a 4th order Bézier?, Urs Liska, 2016/09/18
- Re: What to do wanting a 4th order Bézier?, Simon Albrecht, 2016/09/18
- Re: What to do wanting a 4th order Bézier?, David Kastrup, 2016/09/18
- Re: What to do wanting a 4th order Bézier?, Urs Liska, 2016/09/18
- Re: What to do wanting a 4th order Bézier?, David Kastrup, 2016/09/18
- Re: What to do wanting a 4th order Bézier?, Urs Liska, 2016/09/18
- Re: What to do wanting a 4th order Bézier?, David Kastrup, 2016/09/18
- Re: What to do wanting a 4th order Bézier?, Urs Liska, 2016/09/19
- Re: What to do wanting a 4th order Bézier?, Urs Liska, 2016/09/19
- Re: What to do wanting a 4th order Bézier?, David Kastrup, 2016/09/19