lilypond-devel
[Top][All Lists]
Advanced

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

Re: Implement make-bow-stencil, make-tie-stencil for use in markup-comma


From: dak
Subject: Re: Implement make-bow-stencil, make-tie-stencil for use in markup-commands undertie and overtie (issue 270640043 by address@hidden)
Date: Sun, 08 Nov 2015 23:54:37 +0000

On 2015/11/08 23:22:51, thomasmorley651 wrote:
https://codereview.appspot.com/270640043/diff/20001/scm/stencil.scm
File scm/stencil.scm (right):


https://codereview.appspot.com/270640043/diff/20001/scm/stencil.scm#newcode88
scm/stencil.scm:88: (sqrt (+ (* width width) (* height height))))
On 2015/11/08 21:22:04, dak wrote:
> Is there a reason you are actually taking the absolute values of
width and
> height?  You don't need them for calculating the length here.

Not sure what you mean.
Isn't it simple Pythagoras?


https://codereview.appspot.com/270640043/diff/20001/scm/stencil.scm#newcode100
scm/stencil.scm:100: (/ height length-to-print))))
On 2015/11/08 21:22:04, dak wrote:
> This looks like a total mess.  Do you even need all this for
something?  What
> are you trying to do?
>
> Perhaps express it in words and we'll try finding a direct
representation that
> does not need all this juggling with angles and stuff.

You ask for quadrant and angle-start/stop-X-axis, right?

I hoped I had put in enough comments to explain what's done and why,
obviously
not sufficient.

In general I have to points P(x1 y1) and Q(x2 y2) and want to create a
bow
connecting them.
Therefore I first boil down it, to create a bow from Zero(0 0) to a
point on the
(positive-part) of X-axis with with the coordinates
(direct-distance-P-Q 0),
because it's far easier to calculate.
After this is done the bow is rotated around Zero to have it the same
orientation like the direct connection of P and Q.
Last step is to move the bow from Zero to P.

For the rotating part I need the value of the angle which depends on
the
quadrants of Q relative to P. Calculated using Zero and P moved to
'new-stop'

Hope this is clearer now.

In general I regard the section containing quadrant and
angle-start/stop-X-axis
the weakest part of the code.
Any suggestion is highly welcome.

What do you need angles and quadrants for?

Assuming that you create your bow as a bow from (0,0) to (1,0),
you can then transform a point (x0,y0) on this bow to one from P(x1 y1)
to Q(x2 y2)
by using (x0*(x2-x1)-y0*(y2-y1)+x1, x0*(y2-y1)+y0*(x2-x1)+y1)
assuming that I did not make a mistake here.  No quadrants, no angles,
no trigonometry,
no square roots.

https://codereview.appspot.com/270640043/



reply via email to

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