Re: How to get X/Y-extent of a bezier-curve?
> > > Expected: (0 . 10) > Actually: (6.12323399573677e-16 . 10.0) > > What's the best method to get the zero? > Using simple `round' will not work, because I don't want to get > integers for other fractions of PI. > in pseudo code: if abs(x) < 0.001 then x=0 or round(x, 3) if 3 decimals is your accuracy Greetings, Ed ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: How to get X/Y-extent of a bezier-curve?
Thomas Morleywrites: > 2015-10-07 14:08 GMT+02:00 Thomas Morley : > >> The code in my initial mail uses coord-rotate (not >> ly:stencil-rotate-absolute as in Jans suggestion) >> What do you think about this method? >> >> Ofcourse it was heavily simplified, maybe best to put up a patch to >> have the full code for more detailed discussion. > > I have to postpone uploading the patch, there are some glitches ... > > And one thing which has driven me crazy, before I found the culprit: > `coord-rotate' has a problem which can be demonstrated with: > > (display (coord-rotate '(10 . 0) (/ PI 2))) > > Expected: (0 . 10) > Actually: (6.12323399573677e-16 . 10.0) > > What's the best method to get the zero? coord-translate is written awfully (almost any intermediate use of atan is an indicator of unnecessary contortions) but that's not the problem here. The problem is that GUILE stores floating point number as double numbers (64 bits), and the MPU does its calculations, including trigonometry, using long double arithmetic (80 bits on x86). Consequently, there is no representation of PI in GUILE that would lead to the expected results. When angles are represented un GUILE, you are probably indeed best off using degrees rather than radians since small multiples of 45 are exactly representable at any number resolution available to GUILE. The code used in ly:stencil-rotate-absolute looks like it might work (though I'd write (a * (M_PI / 180.0)) rather than (a * M_PI / 180.0)). -- David Kastrup ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: How to get X/Y-extent of a bezier-curve?
2015-10-09 8:20 GMT+02:00 David Kastrup: > Thomas Morley writes: > >> 2015-10-07 14:08 GMT+02:00 Thomas Morley : >> >>> The code in my initial mail uses coord-rotate (not >>> ly:stencil-rotate-absolute as in Jans suggestion) >>> What do you think about this method? >>> >>> Ofcourse it was heavily simplified, maybe best to put up a patch to >>> have the full code for more detailed discussion. >> >> I have to postpone uploading the patch, there are some glitches ... >> >> And one thing which has driven me crazy, before I found the culprit: >> `coord-rotate' has a problem which can be demonstrated with: >> >> (display (coord-rotate '(10 . 0) (/ PI 2))) >> >> Expected: (0 . 10) >> Actually: (6.12323399573677e-16 . 10.0) >> >> What's the best method to get the zero? > > coord-translate is written awfully (almost any intermediate use of atan > is an indicator of unnecessary contortions) but that's not the problem > here. The problem is that GUILE stores floating point number as double > numbers (64 bits), and the MPU does its calculations, including > trigonometry, using long double arithmetic (80 bits on x86). > Consequently, there is no representation of PI in GUILE that would lead > to the expected results. Ok, thanks for the explanation. > > When angles are represented un GUILE, you are probably indeed best off > using degrees rather than radians since small multiples of 45 are > exactly representable at any number resolution available to GUILE. Well, coord-rotate uses sin and cos for the final result. They both expect their argument as radians. Converting them with `degrees->radians' involves PI again. So far the obvious ... Consequently I tried to redefine coord-rotate without depending on PI or at least without trigonometric functions. Up to now without result. Actually, I have no clue how to. Maybe I fallback to some rounding like Ed suggested (thanks for that) Something at the lines of `close-enough?' from music-functions.scm > > The code used in ly:stencil-rotate-absolute looks like it might work > (though I'd write (a * (M_PI / 180.0)) rather than (a * M_PI / 180.0)). If I understand this correctly (and I probably don't), I don't see how it would help. Thanks, Harm ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: How to get X/Y-extent of a bezier-curve?
Thomas Morleywrites: > 2015-10-09 8:20 GMT+02:00 David Kastrup : >> Thomas Morley writes: >> >>> 2015-10-07 14:08 GMT+02:00 Thomas Morley : >>> The code in my initial mail uses coord-rotate (not ly:stencil-rotate-absolute as in Jans suggestion) What do you think about this method? Ofcourse it was heavily simplified, maybe best to put up a patch to have the full code for more detailed discussion. >>> >>> I have to postpone uploading the patch, there are some glitches ... >>> >>> And one thing which has driven me crazy, before I found the culprit: >>> `coord-rotate' has a problem which can be demonstrated with: >>> >>> (display (coord-rotate '(10 . 0) (/ PI 2))) >>> >>> Expected: (0 . 10) >>> Actually: (6.12323399573677e-16 . 10.0) >>> >>> What's the best method to get the zero? >> >> coord-translate is written awfully (almost any intermediate use of atan >> is an indicator of unnecessary contortions) but that's not the problem >> here. The problem is that GUILE stores floating point number as double >> numbers (64 bits), and the MPU does its calculations, including >> trigonometry, using long double arithmetic (80 bits on x86). >> Consequently, there is no representation of PI in GUILE that would lead >> to the expected results. > > Ok, thanks for the explanation. > >> When angles are represented un GUILE, you are probably indeed best off >> using degrees rather than radians since small multiples of 45 are >> exactly representable at any number resolution available to GUILE. > > Well, coord-rotate uses sin and cos for the final result. They both > expect their argument as radians. Converting them with > `degrees->radians' involves PI again. > So far the obvious ... > > Consequently I tried to redefine coord-rotate without depending on PI > or at least without trigonometric functions. > Up to now without result. > Actually, I have no clue how to. Oh, that won't work. But sin(0) and cos(0) are exact. What one can do is to divide the given number by PI/4, and truncate to get the octant in question. Then you do something like cos (x), sin (x) for octants 0, 7 -sin (x-PI/2), -cos (x-PI/2) for octants 1, 2 -cos (x-PI), -sin (x-PI) for octants 3, 4 sin (x-3PI/2), cos (x-3PI/2) for octants 5, 6 and get the proper 0 and 1 for GUILE's ideas of PI, PI/2 and 3PI/2. Or, probably saner, for GUILE's ideas of 180, 90, and 270. Namely work with degrees even when dividing into octants and only convert to radians at the very last moment. When you do this stuff separately for every octant, you get exact results where you really need them. Probably the best you can do without reverting to C altogether. >> The code used in ly:stencil-rotate-absolute looks like it might work >> (though I'd write (a * (M_PI / 180.0)) rather than (a * M_PI / >> 180.0)). > > If I understand this correctly (and I probably don't), I don't see how > it would help. stencil-rotate-absolute takes its angle in degrees and converts into radians in a manner that seems more likely not to lose the necessary precision. -- David Kastrup ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: How to get X/Y-extent of a bezier-curve?
2015-10-07 14:08 GMT+02:00 Thomas Morley: > The code in my initial mail uses coord-rotate (not > ly:stencil-rotate-absolute as in Jans suggestion) > What do you think about this method? > > Ofcourse it was heavily simplified, maybe best to put up a patch to > have the full code for more detailed discussion. I have to postpone uploading the patch, there are some glitches ... And one thing which has driven me crazy, before I found the culprit: `coord-rotate' has a problem which can be demonstrated with: (display (coord-rotate '(10 . 0) (/ PI 2))) Expected: (0 . 10) Actually: (6.12323399573677e-16 . 10.0) What's the best method to get the zero? Using simple `round' will not work, because I don't want to get integers for other fractions of PI. And I don't know how to identify such a value. Simply ignoring looks not like an option, I had examples where rounding errors cumulated up to visible changes in the final pdf. Cheers, Harm ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: How to get X/Y-extent of a bezier-curve?
2015-10-07 13:13 GMT+02:00 David Kastrup: >> Thomas Morley writes: >> I think we could replace the body of current >> make-bezier-sandwich-stencil with make-path-stencil. >> But obviously you think about some deeper modification. >> Could you give some details? > > No, not really. When I tabled this issue, I thought that > make-bezier-sandwich was dead for some reason but I think that it's used > in several places such as (obviously related) slurs. Well: git grep make-bezier-sandwich-stencil scm/fret-diagrams.scm:(make-bezier-sandwich-stencil scm/stencil.scm:(define (make-bezier-sandwich-stencil coords thick xext yext) scm/stencil.scm:(make-bezier-sandwich-stencil Not much. > And I found it > awkward to use the undertie as the basic shape and derive parentheses > via rotation. The code in my initial mail uses coord-rotate (not ly:stencil-rotate-absolute as in Jans suggestion) What do you think about this method? Ofcourse it was heavily simplified, maybe best to put up a patch to have the full code for more detailed discussion. > And I thought this was essentially user-level code > needing significant modification. > > All in all, I had a significant number of misconceptions about the work > involved with completing this issue and even though becoming gradually > aware of them I never picked up that dropped ball again. > > It should be reasonably low-hanging fruit. > > With regard to my comments to make-path-stencil's operation, the numeric > code is just not what I like. > > If you take a look at the following, it is quite inefficient since it > repeats a lot of calculations instead of assigning partial results to > let-bound variables. It also uses the straight PQ formula whereas the > usual way to avoid numerical inaccuracies is to use the PQ formula only > for the zero where the sign of the +/- does not lead to cancellation and > get the other zero via Viata's rule. > > (define (bezier-part-min-max x1 x2 x3 x4) [...] No promise, but maybe I'll take a look. Not that I know about Viata's or L'hopital's rule, but google maybe helpfull, otherwise I'll reask Cheers, Harm ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: How to get X/Y-extent of a bezier-curve?
2015-10-06 14:49 GMT+02:00 David Kastrup: > Thomas Morley writes: > >> Hi all, >> >> I'm going to write a generic bow-stencil. >> Below you'll find a boiled down example. >> >> The main problem: how to determine the correct extents. >> Looks like I need to calculate the actual X/Y-extents of the resulting >> bezier-curve. >> Though, obviously my maths-skills are not sufficient. > > Oh, that's a nuisance. > >> Any hints? > > I'd just call make-path-stencil and use the bounding box results from > that. No need to reinvent the wheel. Yep. Using make-path-stencil is much more straight-forward. Thanks. If someone interested, I'll attach an image with an excerpt of my test-suite. I plan to replace make-parenthesis-stencil and to implement https://sourceforge.net/p/testlilyissues/issues/3088/ > > While this particular wheel could likely profit from a do-over with more > of a view towards efficiency and numerical robustness, there is no point > in code duplication. I think we could replace the body of current make-bezier-sandwich-stencil with make-path-stencil. But obviously you think about some deeper modification. Could you give some details? Cheers, Harm ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: How to get X/Y-extent of a bezier-curve?
2015-10-06 15:15 GMT+02:00 BB: > I do not really understand what you desire to get. May be my response is not > helpful but silly. The constructed bezier-curves should get correct bounding-boxes. Which can be watched by doing \markup \box \stencil #whatever-stencil > > #(define pts-list > '((12 . 8) > (5 . 8) > (2 . 2) > (15 . 2))) > > In your List you have the start point defined with ay (x.y)= (2,2) and the > end point (15,2) - that is the last pair of coordinates. > > Looks like I need to calculate the actual X/Y-extents of the resulting > bezier-curve. > > The x extent of your curve therefore is 15-2 = 13. Ofc true for `pts-list', but not for the rotated derivates > The y extent is harder to calculate as it depends on the parameters of the > bezier definition. A good description is here: > http://www.math.ucla.edu/~baker/149.1.02w/handouts/bb_bezier.pdf Thanks for it. > > The line override does nothing? > > \override #'(box-padding . 0) Play around with different values. > > If you set (0,0) instead of (2.2) the starting point is at (0.0) and this is > the rotation center. (You rotate in your example around this point.) Then > you have to change the last corrdinate pair to (13,0) for to get the seme > base length and to stay in the box. > > The first coordinate pair of the definition in > > #(define pts-list > > controls the steepness of the start and end of the curve and the form, > please see the link above for details. > > May be I missed the point? I followed David's hint with up to now convincing results. `make-path-stencil' does correct bounding-boxes out of the box. Cheers, Harm ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: How to get X/Y-extent of a bezier-curve?
Thomas Morleywrites: > 2015-10-06 14:49 GMT+02:00 David Kastrup : >> Thomas Morley writes: >> >>> Hi all, >>> >>> I'm going to write a generic bow-stencil. >>> Below you'll find a boiled down example. >>> >>> The main problem: how to determine the correct extents. >>> Looks like I need to calculate the actual X/Y-extents of the resulting >>> bezier-curve. >>> Though, obviously my maths-skills are not sufficient. >> >> Oh, that's a nuisance. >> >>> Any hints? >> >> I'd just call make-path-stencil and use the bounding box results from >> that. No need to reinvent the wheel. > > Yep. > Using make-path-stencil is much more straight-forward. > Thanks. > > If someone interested, I'll attach an image with an excerpt of my test-suite. > > I plan to replace make-parenthesis-stencil and to implement > https://sourceforge.net/p/testlilyissues/issues/3088/ > >> >> While this particular wheel could likely profit from a do-over with more >> of a view towards efficiency and numerical robustness, there is no point >> in code duplication. > > I think we could replace the body of current > make-bezier-sandwich-stencil with make-path-stencil. > But obviously you think about some deeper modification. > Could you give some details? No, not really. When I tabled this issue, I thought that make-bezier-sandwich was dead for some reason but I think that it's used in several places such as (obviously related) slurs. And I found it awkward to use the undertie as the basic shape and derive parentheses via rotation. And I thought this was essentially user-level code needing significant modification. All in all, I had a significant number of misconceptions about the work involved with completing this issue and even though becoming gradually aware of them I never picked up that dropped ball again. It should be reasonably low-hanging fruit. With regard to my comments to make-path-stencil's operation, the numeric code is just not what I like. If you take a look at the following, it is quite inefficient since it repeats a lot of calculations instead of assigning partial results to let-bound variables. It also uses the straight PQ formula whereas the usual way to avoid numerical inaccuracies is to use the PQ formula only for the zero where the sign of the +/- does not lead to cancellation and get the other zero via Viata's rule. (define (bezier-part-min-max x1 x2 x3 x4) ((lambda (x) (list (reduce min 1 x) (reduce max -1 x))) (map (lambda (x) (+ (* x1 (expt (- 1 x) 3)) (+ (* 3 (* x2 (* (expt (- 1 x) 2) x))) (+ (* 3 (* x3 (* (- 1 x) (expt x 2 (* x4 (expt x 3)) (if (< (+ (expt x2 2) (+ (expt x3 2) (* x1 x4))) (+ (* x1 x3) (+ (* x2 x4) (* x2 x3 (list 0.0 1.0) (filter (lambda (x) (and (>= x 0) (<= x 1))) (append (list 0.0 1.0) (map (lambda (op) (if (not (eqv? 0.0 (exact->inexact (- (+ x1 (* 3 x3)) (+ x4 (* 3 x2)) ;; Zeros of the bezier curve (/ (+ (- x1 (* 2 x2)) (op x3 (sqrt (- (+ (expt x2 2) (+ (expt x3 2) (* x1 x4))) (+ (* x1 x3) (+ (* x2 x4) (* x2 x3))) (- (+ x1 (* 3 x3)) (+ x4 (* 3 x2 ;; Apply L'hopital's rule to get the zeros if 0/0 (* (op 0 1) (/ (/ (- x4 x3) 2) (sqrt (- (+ (* x2 x2) (+ (* x3 x3) (* x1 x4))) (+ (* x1 x3) (+ (* x2 x4) (* x2 x3) (list + - -- David Kastrup ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: How to get X/Y-extent of a bezier-curve?
Just for fun tried to undertie all the text with one unertie \markup \line { \undertie { \underline "underlined" \undertie "undertied" \override #'(offset . 5) \override #'(thickness . 1) \undertie "undertied" \override #'(offset . 1) \override #'(thickness . 5) \undertie "undertied" "Eng" \undertie "ele" "en" } } It is only possible to override the vertical coordinate? It is not possible to override start and end coordinate to produce inclined ties? Regards On 07.10.2015 12:14, Thomas Morley wrote: 2015-10-06 14:49 GMT+02:00 David Kastrup: Thomas Morley writes: Hi all, I'm going to write a generic bow-stencil. Below you'll find a boiled down example. The main problem: how to determine the correct extents. Looks like I need to calculate the actual X/Y-extents of the resulting bezier-curve. Though, obviously my maths-skills are not sufficient. Oh, that's a nuisance. Any hints? I'd just call make-path-stencil and use the bounding box results from that. No need to reinvent the wheel. Yep. Using make-path-stencil is much more straight-forward. Thanks. If someone interested, I'll attach an image with an excerpt of my test-suite. I plan to replace make-parenthesis-stencil and to implement https://sourceforge.net/p/testlilyissues/issues/3088/ While this particular wheel could likely profit from a do-over with more of a view towards efficiency and numerical robustness, there is no point in code duplication. I think we could replace the body of current make-bezier-sandwich-stencil with make-path-stencil. But obviously you think about some deeper modification. Could you give some details? Cheers, Harm ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: How to get X/Y-extent of a bezier-curve?
2015-10-07 13:14 GMT+02:00 BB: > Just for fun tried to undertie all the text with one unertie > > \markup \line { > > \undertie { > > \underline "underlined" > > \undertie "undertied" > > \override #'(offset . 5) > > \override #'(thickness . 1) > > \undertie "undertied" > > \override #'(offset . 1) > > \override #'(thickness . 5) > > \undertie "undertied" > > "Eng" \undertie "ele" "en" > > } > > } > > > It is only possible to override the vertical coordinate? It is not possible > to override start and end coordinate to produce inclined ties? Well, undertie is not yet implemented in the source ... > > Regards > > > On 07.10.2015 12:14, Thomas Morley wrote: > I plan to replace make-parenthesis-stencil and to implement > https://sourceforge.net/p/testlilyissues/issues/3088/ ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: How to get X/Y-extent of a bezier-curve?
Thomas Morleywrites: > 2015-10-07 13:13 GMT+02:00 David Kastrup : > >> If you take a look at the following, it is quite inefficient since it >> repeats a lot of calculations instead of assigning partial results to >> let-bound variables. It also uses the straight PQ formula whereas the >> usual way to avoid numerical inaccuracies is to use the PQ formula only >> for the zero where the sign of the +/- does not lead to cancellation and >> get the other zero via Viata's rule. >> >> (define (bezier-part-min-max x1 x2 x3 x4) > [...] > > No promise, but maybe I'll take a look. > Not that I know about Viata's or L'hopital's rule, but google maybe > helpfull, otherwise I'll reask Uh, it's Vieta's rule, sorry for the typo. L'hopital is a rule for the limit of fractions (basically, when f/g -> 0/0 you might get the limiting value by looking at the limit of the quotient of derivatives f'/g' instead). No idea how it would apply here. -- David Kastrup ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
How to get X/Y-extent of a bezier-curve?
Hi all, I'm going to write a generic bow-stencil. Below you'll find a boiled down example. The main problem: how to determine the correct extents. Looks like I need to calculate the actual X/Y-extents of the resulting bezier-curve. Though, obviously my maths-skills are not sufficient. Any hints? \version "2.18.2" %% `overlay' is in the source for 2.19.28 %% for lower versions use: #(define-markup-command (overlay layout props args) (markup-list?) (apply ly:stencil-add (interpret-markup-list layout props args))) #(define (make-simple-bezier-stencil coords) (let* ((command-list `(moveto ,(car (list-ref coords 3)) ,(cdr (list-ref coords 3)) curveto ,(car (list-ref coords 0)) ,(cdr (list-ref coords 0)) ,(car (list-ref coords 1)) ,(cdr (list-ref coords 1)) ,(car (list-ref coords 2)) ,(cdr (list-ref coords 2)) ))) (ly:make-stencil `(path 0.1 `(,@' ,command-list) 'round 'round #f) TODO How to get correct extents? ;; xext: (cons (car (list-ref coords 2)) (car (list-ref coords 3))) ;;yext: (cons (cdr (list-ref coords 2)) (cdr (list-ref coords 1))) ))) % %% EXAMPLE % #(define pts-list '((12 . 8) (5 . 8) (2 . 2) (15 . 2))) #(define (rotated-pts-list degree) (map (lambda (c) TODO ;; coord-rotate rotates around '(0 . 0) ;; make it generic (coord-rotate c (degrees->radians degree))) pts-list)) \markup \column { \vspace #3 \fill-line { \overlay { \circle \null %% representing point '(0 . 0) \override #'(box-padding . 0) \box \with-color #red { \stencil #(make-simple-bezier-stencil pts-list) \stencil #(make-simple-bezier-stencil (rotated-pts-list 90)) \stencil #(make-simple-bezier-stencil (rotated-pts-list 60)) } } } } Cheers, Harm ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: How to get X/Y-extent of a bezier-curve?
I do not really understand what you desire to get. May be my response is not helpful but silly. #(define pts-list '((12 . 8) (5 . 8) (2 . 2) (15 . 2))) In your List you have the start point defined with ay (x.y)= (2,2) and the end point (15,2) - that is the last pair of coordinates. Looks like I need to calculate the actual X/Y-extents of the resulting bezier-curve. The x extent of your curve therefore is 15-2 = 13. The y extent is harder to calculate as it depends on the parameters of the bezier definition. A good description is here: http://www.math.ucla.edu/~baker/149.1.02w/handouts/bb_bezier.pdf The line override does nothing? \override #'(box-padding . 0) If you set (0,0) instead of (2.2) the starting point is at (0.0) and this is the rotation center. (You rotate in your example around this point.) Then you have to change the last corrdinate pair to (13,0) for to get the seme base length and to stay in the box. The first coordinate pair of the definition in #(define pts-list controls the steepness of the start and end of the curve and the form, please see the link above for details. May be I missed the point? Regards On 06.10.2015 13:37, Thomas Morley wrote: Hi all, I'm going to write a generic bow-stencil. Below you'll find a boiled down example. The main problem: how to determine the correct extents. Looks like I need to calculate the actual X/Y-extents of the resulting bezier-curve. Though, obviously my maths-skills are not sufficient. Any hints? \version "2.18.2" %% `overlay' is in the source for 2.19.28 %% for lower versions use: #(define-markup-command (overlay layout props args) (markup-list?) (apply ly:stencil-add (interpret-markup-list layout props args))) #(define (make-simple-bezier-stencil coords) (let* ((command-list `(moveto ,(car (list-ref coords 3)) ,(cdr (list-ref coords 3)) curveto ,(car (list-ref coords 0)) ,(cdr (list-ref coords 0)) ,(car (list-ref coords 1)) ,(cdr (list-ref coords 1)) ,(car (list-ref coords 2)) ,(cdr (list-ref coords 2)) ))) (ly:make-stencil `(path 0.1 `(,@' ,command-list) 'round 'round #f) TODO How to get correct extents? ;; xext: (cons (car (list-ref coords 2)) (car (list-ref coords 3))) ;;yext: (cons (cdr (list-ref coords 2)) (cdr (list-ref coords 1))) ))) % %% EXAMPLE % #(define pts-list '((12 . 8) (5 . 8) (2 . 2) (15 . 2))) #(define (rotated-pts-list degree) (map (lambda (c) TODO ;; coord-rotate rotates around '(0 . 0) ;; make it generic (coord-rotate c (degrees->radians degree))) pts-list)) \markup \column { \vspace #3 \fill-line { \overlay { \circle \null %% representing point '(0 . 0) \override #'(box-padding . 0) \box \with-color #red { \stencil #(make-simple-bezier-stencil pts-list) \stencil #(make-simple-bezier-stencil (rotated-pts-list 90)) \stencil #(make-simple-bezier-stencil (rotated-pts-list 60)) } } } } Cheers, Harm ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: How to get X/Y-extent of a bezier-curve?
Thomas Morleywrites: > Hi all, > > I'm going to write a generic bow-stencil. > Below you'll find a boiled down example. > > The main problem: how to determine the correct extents. > Looks like I need to calculate the actual X/Y-extents of the resulting > bezier-curve. > Though, obviously my maths-skills are not sufficient. Oh, that's a nuisance. > Any hints? I'd just call make-path-stencil and use the bounding box results from that. No need to reinvent the wheel. While this particular wheel could likely profit from a do-over with more of a view towards efficiency and numerical robustness, there is no point in code duplication. -- David Kastrup ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user