[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Oval stencil and oval markup suggestions
From: |
Thomas Morley |
Subject: |
Re: Oval stencil and oval markup suggestions |
Date: |
Thu, 4 Apr 2019 22:03:08 +0200 |
Am Do., 4. Apr. 2019 um 17:34 Uhr schrieb Pierre Perol-Schneider
<address@hidden>:
>
> Hi Dev Team,
> Here's some thougts:
>
> %%%%%%
> \version "2.19.83"
>
> %% The oval stencil commands uses beziers curves that cause some side
> effects:
> \markuplist {
> \line\vcenter {
> "Circle, radius = 2 : "
> \stencil #(make-circle-stencil 2 .13 #f)
> }
> \line\vcenter {
> "Oval, x-radius = y-radius = 2 : "
> \stencil #(make-oval-stencil 2 2 .13 #f)
> }
> \line\vcenter {
> "Oval extents, x-radius = y-radius = 2 : "
> \box\stencil #(make-oval-stencil 2 2 .13 #f)
> }
> }
>
> %% Here's a suggestion with a corrected y-radius in order to reach a quasi
> circle:
[...]
Hi Pierre,
current `make-oval-stencil´, used via `oval-stencil´ in the
`oval´-markup-command uses beziers, yes.
Though, you will never get a perfect circle using beziers. I don't
understand why you see this as an issue.
Maybe the naming x-radius/y-radius is misleading, because x-radius
mirrors the final x-extent, but y-radius the y-extent of the
control-points, not of the final oval.
Ofcourse this has impact an the final dimensions, which you
demonstrated by applying \box.
If we think this is a problem I'd rather suggest to do:
#(define-public (make-oval-stencil-harm x-radius y-radius thickness fill)
"Make an oval from two Bezier curves, of address@hidden @var{x-radius},
address@hidden @code{y-radius}, and thickness @var{thickness} with fill
defined by @code{fill}."
(let*
((x-out-radius (+ x-radius (/ thickness 2.0)))
(y-out-radius (+ y-radius (/ thickness 2.0)))
(x-max x-radius)
(x-min (- x-radius))
(y-max y-radius)
(y-min (- y-radius))
(commands `(,(list 'moveto x-max 0)
,(list 'curveto x-max y-max x-min y-max x-min 0)
,(list 'curveto x-min y-min x-max y-min x-max 0)
,(list 'closepath)))
(command-list (fold-right append '() commands)))
;(ly:make-stencil
; `(path ,thickness `(,@',command-list) 'round 'round ,fill)
; (cons (- x-out-radius) x-out-radius)
; (cons (- y-out-radius) y-out-radius))
(make-path-stencil
command-list
thickness 1 1 fill)))
Cheers,
Harm