[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Variable slur thickness
From: |
Thomas Morley |
Subject: |
Re: Variable slur thickness |
Date: |
Fri, 11 Mar 2016 21:51:23 +0100 |
2016-03-11 14:31 GMT+01:00 Sharon Rosner <address@hidden>:
>> I've managed to bypass using before-line-breaking AND after-line-breaking
>> by assigning the function to the 'thickness property and having each grob
>> internally calculate its own control points rather than relying on it
>> being
>> calculated elsewhere (also attached):
>
> Works great! I improved it further by making it compatible with ties too:
>
>
> #(define (variable-slur-thickness min-l max-l min-t max-t) (lambda (grob)
> (let* ((cpf (if (grob::has-interface grob 'tie-interface)
> ly:tie::calc-control-points
> ly:slur::calc-control-points))
> (cpt (cpf grob))
> (cp0 (car cpt)) (cp3 (cadddr cpt))
> (dx (- (car cp3) (car cp0)))
> (dy (- (cdr cp3) (cdr cp0)))
> (len (magnitude (make-rectangular dx dy)))
> (thickness
> (cond ((< len min-l) min-t)
> ((> len max-l) max-t)
> (else (+ min-t (* (- len min-l)
> (/ (- max-t min-t) (- max-l min-l))))))))
>
> thickness)))
>
>
>> The only thing I'm (slightly) concerned with is
>> the duplicate control-point calculation in this function and how it might
>> affect compilation times if this were applied to a large orchestral score,
>> for example.
>
> A preliminary check with a 17-page score shows a pretty negligible effect on
> compilation time, 0.6s (the total time is about 21s), or about 2.7%
> additional compilation time. A small price to pay for more beauty!
>
> Sharon
How about below,
Should work for all bows, hence the name is changed
#(define (variable-bow-thickness min-l max-l min-t max-t)
(lambda (grob)
;; Get the procedure to calculate the control-points
;; If none use `fall-back' to return a default-value for 'thickness
(let ((cpf (assoc-get 'control-points (ly:grob-basic-properties grob)))
(fall-back 1.2))
(if (procedure? cpf)
(let* ((cpt (cpf grob))
(cp0 (car cpt))
(cp3 (cadddr cpt))
(dx (- (car cp3) (car cp0)))
(dy (- (cdr cp3) (cdr cp0)))
(len (magnitude (make-rectangular dx dy)))
(thickness
(cond ((< len min-l) min-t)
((> len max-l) max-t)
(else (+ min-t (* (- len min-l)
(/ (- max-t min-t) (- max-l min-l))))))))
thickness)
fall-back))))
Cheers,
Harm
- Re: Variable slur thickness, (continued)
- Re: Variable slur thickness, Sharon Rosner, 2016/03/10
- Re: Variable slur thickness, Thomas Morley, 2016/03/10
- Re: Variable slur thickness, Sharon Rosner, 2016/03/10
- Re: Variable slur thickness, Thomas Morley, 2016/03/11
- Re: Variable slur thickness, Sharon Rosner, 2016/03/11
- Re: Variable slur thickness, Thomas Morley, 2016/03/11
- Re: Variable slur thickness, Sharon Rosner, 2016/03/11
- Re: Variable slur thickness, Thomas Morley, 2016/03/11
- Re: Variable slur thickness, tisimst, 2016/03/11
- Re: Variable slur thickness, Sharon Rosner, 2016/03/11
- Re: Variable slur thickness,
Thomas Morley <=
- Re: Variable slur thickness, tisimst, 2016/03/10
- Re: Variable slur thickness, Malte Meyn, 2016/03/10
- Re: Variable slur thickness, tisimst, 2016/03/10
- Re: Variable slur thickness, Thomas Morley, 2016/03/10