1 #include "idealspacing.hh"
4 #include "paper-def.hh"
5 #include "score-column.hh"
10 this needs A LOT of rethinking.
12 generate springs between columns.
16 Score::calc_idealspacing()
22 PCursor
<Score_column
*> j(i
+1);
25 for (int n
=0; n
< i
->durations
.size(); n
++) {
26 Moment d
= i
->durations
[n
];
27 Real dist
= paper_p_
->duration_to_dist(d
);
28 Real strength
= i
->durations
[0]/i
->durations
[n
];
29 assert(strength
<= 1.0);
31 while (j
->when() < d
+ i
->when())
33 Moment delta_desired
= j
->when() - (d
+i
->when());
34 dist
+= paper_p_
->duration_to_dist(delta_desired
);
36 pscore_p_
->connect(i
->pcol_l_
, j
->pcol_l_
, dist
, strength
);
40 /* attach i to the next column in use. This exists, since
41 the last col is breakable, and therefore in use
44 Moment d
= j
->when() - i
->when();
45 Real dist
= (d
) ? paper_p_
->duration_to_dist(d
) : 2 PT
; // todo
47 pscore_p_
->connect(i
->pcol_l_
, j
->pcol_l_
, dist
, (d
) ? 1.0:1.0);
49 // !j.ok() might hold if we're at the last col.