[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Woodwind diagrams (issue1425041)
From: |
Carl . D . Sorensen |
Subject: |
Re: Woodwind diagrams (issue1425041) |
Date: |
Mon, 31 May 2010 17:47:28 +0000 |
Mike,
I'm sorry, but I had some comments earlier that I somehow erased with
inadvertent keystrokes, so I added them back in.
Thanks,
Carl
http://codereview.appspot.com/1425041/diff/1/8
File scm/lily-library.scm (right):
http://codereview.appspot.com/1425041/diff/1/8#newcode522
scm/lily-library.scm:522: (+
You might want to define some functions (perhaps in lily-lib.scm)
(define (square x) (* x x))
(define (radius coordinate)
(sqrt (+ (square (car coordinate) (cdr coordinate)))))
and perhaps
(define (x-value coordinate) (car coordinate))
(define (y-value coordinate) (cdr coordinate))
http://codereview.appspot.com/1425041/diff/1/8#newcode527
scm/lily-library.scm:527: (eqv? (interval-start interval) 0.0)
You can avoid all these tests by just using the two-argument function of
atan
(angle (atan (interval-end interval) (interval-start interval)))
or even better
(angle (atan (y-value coordinate) (x-value coordinate)))
recognizing that these cons cells aren't really intervals.
http://codereview.appspot.com/1425041/diff/1/10
File scm/output-ps.scm (right):
http://codereview.appspot.com/1425041/diff/1/10#newcode105
scm/output-ps.scm:105: (define (connected-shape pointlist thick x-scale
y-scale connect fill)
On 2010/05/31 14:06:49, Carl wrote:
I find it much easier to read this function in this indentation
format:
(define (connected-shape pointlist thick x-scale y-scale connect fill)
(ly:format "~a~4f ~4f ~4f ~4f ~a ~a draw_connected_shape"
(string-concatenate
(map (lambda (x)
(apply (if (eq? (length x) 6)
(lambda (x1 x2 x3 x4 x5 x6)
(ly:format "~4f ~4f ~4f ~4f ~4f ~4f 6 " x1 x2 x3 x4
x5 x6))
(lambda (x1 x2)
(ly:format "~4f ~4f 2 " x1 x2)))
x))
(reverse pointlist))) (length pointlist)
x-scale
y-scale
thick (if connect "true" "false")
(if fill "true" "false")))
Done.
http://codereview.appspot.com/1425041/diff/1/11
File scm/output-svg.scm (right):
http://codereview.appspot.com/1425041/diff/1/11#newcode354
scm/output-svg.scm:354: ((new-start-angle
You can take advantage of the functions you've defined elsewhere:
(new-start-angle (* PI-OVER-180 (angle-0-360 start-angle)))
http://codereview.appspot.com/1425041/show