lilypond-devel
[Top][All Lists]
Advanced

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

Re: Add \path markup command, and use it for \eyeglasses. (issue1730044


From: Carl . D . Sorensen
Subject: Re: Add \path markup command, and use it for \eyeglasses. (issue1730044)
Date: Tue, 22 Jun 2010 03:50:24 +0000

I've added my draft of an algorithm to estimate the extents.

Thanks,

Carl



http://codereview.appspot.com/1730044/diff/1/2
File scm/define-markup-commands.scm (right):

http://codereview.appspot.com/1730044/diff/1/2#newcode684
scm/define-markup-commands.scm:684: (cons 0 0)))
On 2010/06/21 22:39:53, Patrick McCarty wrote:
On 2010/06/20 11:07:37, Carl wrote:
> Is it possible to have the path command estimate reasonable extents,
rather
> than using (0 . 0) and (0 . 0)?  Since we know the thickness of the
line, and
> we have a list of points, it seems we should be able to keep track
of the
> maximum and minimum X and Y coordinates during the path creation.

This should be possible, but I'm not sure how to implement it,
especially when
relative coordinates are involved.

My first thought would be to start with currentx=currenty=
xmax=xmin=ymax=ymin = 0.

For an absolute move, set currentx = move x, currenty = move y.

For a relative move, set currentx += movex, currenty += movey.

If currentx > xmax, xmax=currentx.  If currenty > ymax, ymax=currenty.
If currentx < xmin, xmin = currentx.  If currenty < ymin, ymin =
currenty.

For curves, go one point at a time.  The control points bound the curve,
so you can use the control points as if they were curve points.

When you're done with all the points, add half the thickness to xmax and
ymax, and subtract half the thickness from xmin and ymin.

I haven't tried it, but it seems to me it should work.

http://codereview.appspot.com/1730044/show



reply via email to

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