On 2015/11/08 23:54:37, dak wrote:
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?
See bottom.
> >
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.
New patch follows your suggestions, thanks a lot for it. One problem remaining, for the length I still use square roots - don't know how to do it different. https://codereview.appspot.com/270640043/ _______________________________________________ lilypond-devel mailing list lilypond-devel@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-devel