Real y = curve.get_other_coordinate (X_AXIS, p[X_AXIS]);
if (y)
{
- fit_factor = fit_factor >? (p[Y_AXIS] / y);
+ fit_factor = max (fit_factor, (p[Y_AXIS] / y));
}
}
return fit_factor;
continue;
Encompass_info inf (state.get_encompass_info (encompasses[i]));
- Real y = state.dir_ * ((state.dir_ * inf.head_) >? (state.dir_ * inf.stem_));
+ Real y = state.dir_ * (max (state.dir_ * inf.head_, state.dir_ * inf.stem_));
avoid.push (Offset (inf.x_, y + state.dir_ * state.parameters_.free_head_distance_));
}
(control3 - control0). */
Real max_indent = len / 3.1;
- indent = indent <? max_indent;
+ indent = min (indent, max_indent);
Real a1 = sqr (len) / 3.0;
Real a2 = 0.75 * sqr (indent + len / 3.0);
if (max_h < 0)
{
- programming_error ("Slur indent too small.");
+ programming_error ("slur indent too small");
max_h = len / 3.0;
}
else
Real ff = fit_factor (dz_unit, dz_perp, curve, state.dir_, avoid);
- height = height >? ((height * ff) <? max_h);
+ height = max (height, min (height * ff, max_h));
curve.control_[0] = attachment_[LEFT];
curve.control_[1] = attachment_[LEFT] + dz_perp * height * state.dir_
Real hd = (head_dy)
? (1 / fabs (head_dy) - 1 / state.parameters_.free_head_distance_)
: state.parameters_.head_encompass_penalty_;
- hd = (hd >? 0)<? state.parameters_.head_encompass_penalty_;
+ hd = min (max (hd, 0.0), state.parameters_.head_encompass_penalty_);
demerit += hd;
}
{
Real closest
- = state.dir_ * (state.dir_ * state.encompass_infos_[j].get_point (state.dir_)
- >? state.dir_ * line_y);
+ = state.dir_ * max (state.dir_ * state.encompass_infos_[j].get_point (state.dir_), state.dir_ * line_y);
Real d = fabs (closest - y);
convex_head_distances.push (d);
// ?
demerit += -state.parameters_.closeness_factor_
* (state.dir_
- * (y - (ext[state.dir_] + state.dir_ * state.parameters_.free_head_distance_))
- <? 0)
+ * min (y - (ext[state.dir_] + state.dir_ * state.parameters_.free_head_distance_), 0.0))
/ state.encompass_infos_.size ();
}
}
Real min_dist = infinity_f;
for (int j = 0; j < convex_head_distances.size (); j++)
{
- min_dist = min_dist <? convex_head_distances[j];
+ min_dist = min (min_dist, convex_head_distances[j]);
avg_distance += convex_head_distances[j];
}
variance_penalty = state.parameters_.head_slur_distance_max_ratio_;
if (min_dist > 0.0)
variance_penalty
- = (avg_distance / (min_dist + state.parameters_.absolute_closeness_measure_) - 1.0)
- <? variance_penalty;
+ = min ((avg_distance / (min_dist + state.parameters_.absolute_closeness_measure_) - 1.0), variance_penalty);
- variance_penalty = variance_penalty >? 0.0;
+ variance_penalty = max (variance_penalty, 0.0);
variance_penalty *= state.parameters_.head_slur_distance_factor_;
}
Real dist = state.extra_encompass_infos_[j].extents_[Y_AXIS].distance (y);
demerit
- += fabs (0 >? (state.parameters_.extra_encompass_free_distance_ - dist))
+ += fabs (max (0.0, (state.parameters_.extra_encompass_free_distance_ - dist)))
/ state.parameters_.extra_encompass_free_distance_
* state.extra_encompass_infos_[j].penalty_;
}
Real slur_dy = slur_dz[Y_AXIS];
Real demerit = 0.0;
- demerit += ((fabs (slur_dy / slur_dz[X_AXIS])
- - state.parameters_.max_slope_) >? 0)
+ demerit += max ((fabs (slur_dy / slur_dz[X_AXIS])
+ - state.parameters_.max_slope_), 0.0)
* state.parameters_.max_slope_factor_;
/* 0.2: account for staffline offset. */
if (!state.is_broken_)
demerit += state.parameters_.steeper_slope_factor_
- * ((fabs (slur_dy) -max_dy) >? 0);
+ * (max (fabs (slur_dy) -max_dy, >? 0.0));
- demerit += ((fabs (slur_dy / slur_dz[X_AXIS])
- - state.parameters_.max_slope_) >? 0)
+ demerit += max ((fabs (slur_dy / slur_dz[X_AXIS])
+ - state.parameters_.max_slope_), 0.0)
* state.parameters_.max_slope_factor_;
if (sign (dy) == 0