Well, not sure actually, since it's problematic with 0, 1 , -1.
So how about :
%circled-pattern
#(define-markup-command
(circled-pattern layout props radius angle num arg)
(number? number? number? string?)
(let* ((rep (- (abs num) 1))
(the-form
(if (eq? num 0) (markup "")
(if (eq? (abs num) 1) (markup arg)
(markup
(#:combine
(#:null)
(fold
(lambda (i prev)
(markup
(#:combine
(#:rotate
(* i (/ angle rep))
(#:concat (#:null #:hspace radius arg)))
prev)))
(markup (#:null))
(iota (1+ rep)))))))))
(interpret-markup layout props the-form)))
testOne = \markup "."
testTwo = \markup { \rotate #45 "!" }
\markup\circled-pattern #5 #180 #15 \testOne
\markup\circled-pattern #5 #-180 #15 \testOne
\markup\circled-pattern #5 #180 #2 \testOne
\markup\circled-pattern #5 #180 #1 \testOne
\markup\circled-pattern #5 #180 #0 \testOne
%\markup\circled-pattern #5 #360 #5 \testTwo
Plus : any idea why 'testTwo does not work ?
Cheers,
Pierre
2018-07-07 15:35 GMT+02:00 Orm Finnendahl <
[email protected]>:
> Hi List,
>
> for conciseness the example should be reduced even more (if someone
> wants to post it to LSR I'd recommend this version).
>
> %circled-pattern
> #(define-markup-command
> (circled-pattern layout props radius angle num arg)
> (number? number? number? string?)
> (interpret-markup layout props
> (fold
> (lambda (i prev)
> (markup
> (#:combine
> (#:rotate
> (* i (/ angle num))
> (#:concat (#:null #:hspace radius arg)))
> prev)))
> (markup (#:null))
> (iota (1+ num))))))
>
> % Test (markup a 180° circled pattern with radius 5 and 17 dots) :
> \markup\circled-pattern #5 #180 #16 #"."
>
> % an upside down pattern can be achieved with a negative angle:
>
> \markup\circled-pattern #5 #-180 #16 #"."
>
_______________________________________________
lilypond-user mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/lilypond-user