2 do calculations for breaking problem
5 #include "paper-def.hh"
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.top() == 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.top(), 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.pop();
45 col_hpos.config = the_sol;
50 Break_algorithm::Break_algorithm(PScore&s)
53 linelength = s.paper_l_->linewidth;
57 Break_algorithm::feasible(Line_of_cols curline) const
60 for (int i=0; i < curline.size(); i++)
61 l +=curline[i]->width().length();
62 return l < linelength;
66 Break_algorithm::problem_OK() const
68 if (!pscore_.cols.size())
69 error("Score does not have any columns");
71 iter_top(pscore_.cols,start);
72 PCursor<PCol *> end (pscore_.cols.bottom());
74 assert(start->breakable_b());
75 assert(end->breakable_b());