[Top][All Lists]

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

Re: Feature request: Display bezier control-points

From: Urs Liska
Subject: Re: Feature request: Display bezier control-points
Date: Fri, 04 May 2012 02:31:06 +0200
User-agent: Mozilla/5.0 (X11; Linux i686; rv:11.0) Gecko/20120329 Thunderbird/11.0.1

Am 04.05.2012 02:08, schrieb David Nalesnik:
Hi Urs,

    > It would be a really valuable feature if one could let LilyPond
    > the control-points of a bezier curve.
    > I would imagine something like a cross or a point at the middle two
    > control-points.

I think this would be very helpful, so that you can visualize exactly what these control-points are that you're setting. (It must be a common misconception that they are points on the actual curve.)

I'm not sure what impact this may have on the layout, but you could do something like the following:

\version "2.15.37"

#(define (make-cross-stencil coords)
    (make-line-stencil 0.1 (- (car coords) 0.2) (- (cdr coords) 0.2)
  (+ (car coords) 0.2) (+ (cdr coords) 0.2))
    (make-line-stencil 0.1 (- (car coords) 0.2) (+ (cdr coords) 0.2)
  (+ (car coords) 0.2) (- (cdr coords) 0.2))))

#(define display-control-points
  (lambda (grob)
    (let ((stencil (ly:slur::print grob))
          (cps (ly:grob-property grob 'control-points)))
      (ly:stencil-add stencil
     (make-cross-stencil (second cps))
     (make-cross-stencil (third cps))))))
\relative c'' {
  \override Slur #'stencil = #display-control-points
  c( d e f)

Hope you find this helpful!
Wow, extremely!
Of course I would prefer to have this built-in.
And as you I can't really judge if this has side effects.
But this really _is_ helping to find suitable values for the control-points.

 * Although I know bezier curves from vector graphics software, I also
   was convinced that the 'control-points' were four points on the
   curve that define its shape.
 * In fact the first and last are such points, whereas the middle two
   'control-points' are the 'handles'.
   -> Is this explained somewhere?
 *  From seeing the crosses I now realize that (when using your
   function) all four offsets are relative to LilyPond's original decision.
   Well, if you think about it, that's quite obvious, but I always
   assumed that if I change one offset the other control-points would
   be affected accordingly.
   But in fact they aren't. So if I for example raise the endpoint of a
   slur, the third control-point may well get below the slur.
   This makes me understand the seemingly strange behaviour of the
   slurs when fiddling with the offsets.
 * -> Probably it'll greatly improve my 'tweaking experience', even if
   I have seen this only once, not to speak if I manage to include this
   in a real-life workflow ...
   So, many thanks once more, David!

I'll test this together with your new offset function (I intended to do it this very evening, but it has become sooo late now (here in Central Europe) ...



reply via email to

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