gnu-music-discuss
[Top][All Lists]
Advanced

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

Re: Glissando line, follow Staff


From: Rune Zedeler
Subject: Re: Glissando line, follow Staff
Date: Tue, 06 Feb 2001 15:54:11 +0100

Rune Zedeler wrote:

> > > I would like an a bit more sophisticated routine for calculating the
> > > glissando lines.
> 
> > Sure, the calculations are in line-spanner.cc, for simple not across
> > line breaks it's just 6 lines or so, now.
> 
> Okay, I'll take a look at it.

I did that. I must admit that it is very slamcoded, but now the lines
look the way I want them.
I have made a simple diff. What options do you normally use?
1.3.128
I found it a bit strange that the note-head hot-spot apparantly is
located at the left(X), center(Y)... Is it so?

-Rune
16a17,18
> #include <math.h>
> 
151c153,155
<   
---
>   Real dist; /*distance between points */
> 
>   Offset ofxy (gap, 0); /*offset from start point to start of line*/
154a159
> 
181,182c186,188
<       dxy[X_AXIS] = bound[RIGHT]->extent (common[X_AXIS], X_AXIS)[LEFT]
<       - bound[LEFT]->extent (common[X_AXIS], X_AXIS)[RIGHT];
---
>       Real off = gap + ((bound[LEFT]->extent (bound[LEFT], X_AXIS).length 
> ()*3)/4); // distance from center to start of line
>       dxy[X_AXIS] = bound[RIGHT]->extent (common[X_AXIS], X_AXIS).center ()
>       - bound[LEFT]->extent (common[X_AXIS], X_AXIS).center ();
185c191,197
<       dxy[X_AXIS] -= 2 * gap;
---
> 
>       dist = sqrt(dxy[X_AXIS]*dxy[X_AXIS]+dxy[Y_AXIS]*dxy[Y_AXIS]);
>       ofxy[X_AXIS] = (dxy[X_AXIS]*off)/dist;
>       ofxy[Y_AXIS] = (dxy[Y_AXIS]*off)/dist;
> 
>       dxy[X_AXIS] -= 2 * ofxy[X_AXIS];
>       dxy[Y_AXIS] -= 2 * ofxy[Y_AXIS];
205c217
<   line.translate_axis (bound[LEFT]->extent (bound[LEFT], X_AXIS).length (), 
X_AXIS); 
---
>   line.translate_axis (bound[LEFT]->extent (bound[LEFT], X_AXIS).length ()/2, 
> X_AXIS); 
207,208c219,220
<   Offset g (gap, 0);
<   line.translate (g - my_off + his_off);
---
>   //Offset g (gap, 0);
>   line.translate (ofxy - my_off + his_off);

reply via email to

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