[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Arrowlines patch version 2
From: |
Han-Wen Nienhuys |
Subject: |
Re: Arrowlines patch version 2 |
Date: |
Sun, 17 Apr 2005 23:22:38 +0200 |
Op zo, 17-04-2005 te 18:26 -0300, schreef Jonatan Liljedahl:
> Here's the new version of my arrowline patch.
>
> It lets you put arrows at the head or tail of a line.
> The arrow is rotated correctly if the line isn't straight.
> Arrow width and length is tunable.
>
> Patch attached,
comments follow,
>+ static Stencil make_arrow (Offset &from, Offset &to, int dir, Real
length, Real width);
don't use & . If you want to modify, use * . Use const& for big
structures. In this case, just copy the arguments.
>+ for(d=0;d<2;d++) if(dir&(1<<d)) {
what's this? If you want to do left and right, use
Direction d = LEFT;
do {
..
} while (flip (&d) != LEFT);
>+ // calculate the coordinates
>+ Real slopy = atan2(d?(y2-y1):(y1-y2),d?(x2-x1):(x1-x2));
>+ Real lcos = cos(slopy)*length, lsin = sin(slopy)*length;
>+ Real wcos = cos(slopy)*width, wsin = sin(slopy)*width;
>+ Real x=d?x1:x2, y=d?y1:y2;
can you look into using
angle = (to -from).arg()
// construct horizontal arrow
// rotate arrow
for (int i = 0; i < points.size() ; i++)
points[i] = points[i] * complex_exp (Offset (0, angle))
this will make the code simpler.
>+ (arrow ,integer? "Add an arrow to the line at 1: end, 2: start,
3: both.")
This is not done. We do not have magical number constants in lilypond.
finally, can you reformat your code according to our standards? i.e.
for (d = 0; d < 2; d++)
{
func (d, x);
}
notice the use of spaces and newlines around , and { }
Can you resubmit your patch? Thanks!
--
Han-Wen Nienhuys - address@hidden
LilyPond Software Design - http://www.lilypond-design.com
Re: Arrowlines patch version 2, Jonatan Liljedahl, 2005/04/17