if (inv_hooke == 0.0) /* avoid division by zero. If springs are infinitely stiff */
inv_hooke = 1e-6; /* then report a very large stretching force */
- assert (cur_len <= line_len_);
+ if (cur_len > (1 + 1e-6) * line_len_)
+ programming_error ("misuse of expand_line");
return (line_len_ - cur_len) / inv_hooke + force_;
}
fits_ = true;
- assert (line_len_ <= cur_len);
-
+ if (line_len_ > (1 + 1e-6) * cur_len)
+ programming_error ("misuse of compress_line");
vector<Spring> sorted_springs = springs_;
sort (sorted_springs.begin (), sorted_springs.end (), greater<Spring> ());
/*
Paranoia check.
*/
- assert (fabs (configuration_length (cur_force) - cur_len) < 1e-6);
+ if (fabs (configuration_length (cur_force) - cur_len) > 1e-6 * cur_len)
+ programming_error (to_string ("mis-predicted force, %.6f ~= %.6f",
+ cur_len, configuration_length(cur_force)));
return cur_force;
}
for (SCM s = Spaceable_grob::get_minimum_distances (col);
scm_is_pair (s); s = scm_cdr (s))
{
- Grob *other = Grob::unsmob (scm_caar (s));
+ Grob *other = unsmob<Grob> (scm_caar (s));
vsize j = binary_search (cols, other, Paper_column::less_than, col_index);
if (j != VPOS)
{
force[b * breaks.size () + c] = infinity_f;
break;
}
- if (end < cols.size () && cols[end].break_permission_ == force_break)
+ if (end < cols.size () && scm_is_eq (cols[end].break_permission_, force_break))
break;
}
}
for (vsize i = 1; i + 1 < ret.cols_.size (); i++)
{
SCM p = ret.cols_[i]->get_property ("line-break-permission");
- if (p == ly_symbol2scm ("force"))
+ if (scm_is_eq (p, ly_symbol2scm ("force")))
ret.satisfies_constraints_ = false;
}