lilypond-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: need markup function for arrow at end of curve


From: Pierre Perol-Schneider
Subject: Re: need markup function for arrow at end of curve
Date: Wed, 8 Mar 2017 14:51:19 +0100

Hi Kieren,

Here's another try:

#(define-markup-command
   (curvedArrow layout props
     arrow-length ;; any number >=0
     height ;; any number >=0
     strait-length ;; any number >=0
     )(number? number? number?)
   "Draw a curved arrow with variable length and height."
   (interpret-markup layout props
     (markup
       (#:override (cons (quote filled) #t)
       (#:path 0.15
         `((curveto   0 ,(+ 0.1 height) ,(+ 2.8 arrow-length) ,(+ 3.3 height) ,(+ 11.3 arrow-length) ,(+ 3.3 height))
           (rlineto   ,strait-length 0)
           (rcurveto  0 0.4 -0.2 0.4 -0.2 0.9)
           (rcurveto  0 0.1 1.2 -0.5 1.8 -0.7)
           (rcurveto  0.6 -0.2 1.5 -0.4 1.5 -0.6)
           (rcurveto  0.0 -0.2 -0.9 -0.3 -1.5 -0.5)
           (rcurveto -0.7 -0.2 -1.8 -0.8 -1.8 -0.7)
           (rcurveto  0 0.5 0.2 0.5 0.2 0.9)
           (rlineto  ,(* -1 strait-length) 0)
           (curveto  ,(+ 3.1 arrow-length) ,(+ 2.6 height) 0 ,(+ -0.1 height) 0 0)
           (closepath)))))))

%% Test:
{
 c'^\markup\curvedArrow #0 #0 #0
 c'^\markup\curvedArrow #2 #5 #0
 c'_\markup\scale #'(-.5 . -.5)\curvedArrow #10 #10 #30
}

Thickness and direction can be change bay using \scale and \rotate
Hope you'll find it useful.

Cheers,
Pierre

2017-03-07 11:23 GMT+01:00 David Kastrup <address@hidden>:
Pierre Perol-Schneider <address@hiddencom> writes:

> Hi Kieren,
> As said,  I worked on it yesterday but the result is not good enough.
> Nevertheless, here's a cleaner version :
>
> \version "2.19"
>
>  #(define-markup-command (curvedArrow layout props X-scale Y-scale)
> (number? number?)
>   (interpret-markup layout props
>    (markup
>     (#:stencil
>      (make-path-stencil
>        '(M 12.0 4.0
>          C 12.0 4.0 16.0 2.5 16 2.5
>          C 16.0 2.5 12.0 1.0 12 1.0
>          C 12.2 2.0 12.0 2.0 12 2.0
>          C  8.0 2.2  2.0 1.2  0 0.0
>          C  2.0 2.0  8.0 3.0 12 3.0
>          C 12.0 3.0 12.2 3.0 12 4.0
>          Z)
>        .15 X-scale Y-scale #t)))))

Huh.  Maybe this kind of work could benefit a whole lot from xfig
<http://mcj.sourceforge.net/> getting a LilyPond markup export option?

--
David Kastrup


reply via email to

[Prev in Thread] Current Thread [Next in Thread]