2 do calculations for breaking problem
6 #include "linespace.hh"
8 #include "scoreline.hh"
13 return all breakable columns
16 Break_algorithm::find_breaks() const
19 for (iter_top(pscore_.cols,c); c.ok(); c++)
22 assert(retval.last() == pscore_.cols.bottom().ptr());
26 // construct an appropriate Spacing_problem and solve it.
28 Break_algorithm::solve_line(Line_of_cols curline) const
32 sp.add_column(curline[0], true, 0.0);
33 for (int i=1; i< curline.size()-1; i++)
34 sp.add_column(curline[i]);
35 sp.add_column(curline.last(), true, linelength);
37 // misschien moeven uit Spacing_problem?
38 for (iter_top(pscore_.suz,i); i.ok(); i++) {
41 Array<Real> the_sol=sp.solve();
42 Col_hpositions col_hpos;
43 col_hpos.cols = curline;
44 col_hpos.energy = the_sol.last();
46 col_hpos.config = the_sol;
51 Break_algorithm::Break_algorithm(PScore&s)
54 linelength = s.paper_l_->linewidth;
58 Break_algorithm::feasible(Line_of_cols curline) const
61 for (int i=0; i < curline.size(); i++)
62 l +=curline[i]->width().length();
63 return l < linelength;
67 Break_algorithm::problem_OK() const
69 if (!pscore_.cols.size())
70 error("Score does not have any columns");
72 iter_top(pscore_.cols,start);
73 PCursor<PCol *> end (pscore_.cols.bottom());
75 assert(start->breakable());
76 assert(end->breakable());