- {
- Real head_dy = (y - state.encompass_infos_[j].head_);
- if (state.dir_ * head_dy < 0)
- {
- demerit += state.parameters_.head_encompass_penalty_;
- convex_head_distances.push (0.0);
- }
- else
- {
- Real hd = (head_dy)
- ? (1 / fabs (head_dy) - 1 / state.parameters_.free_head_distance_)
- : state.parameters_.head_encompass_penalty_;
- hd = min (max (hd, 0.0), state.parameters_.head_encompass_penalty_);
-
- demerit += hd;
- }
-
- Real line_y = linear_interpolate (x,
- attachment_[RIGHT][X_AXIS],
- attachment_[LEFT][X_AXIS],
- attachment_[RIGHT][Y_AXIS],
- attachment_[LEFT][Y_AXIS]);
-
- if (1) // state.dir_ * state.encompass_infos_[j].get_point (state.dir_) > state.dir_ *line_y )
- {
-
- Real closest
- = 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);
- }
- }
+ {
+ Real head_dy = (y - state.encompass_infos_[j].head_);
+ if (state.dir_ * head_dy < 0)
+ {
+ demerit += state.parameters_.head_encompass_penalty_;
+ convex_head_distances.push_back (0.0);
+ }
+ else
+ {
+ Real hd = (head_dy)
+ ? (1 / fabs (head_dy) - 1 / state.parameters_.free_head_distance_)
+ : state.parameters_.head_encompass_penalty_;
+ hd = min (max (hd, 0.0), state.parameters_.head_encompass_penalty_);
+
+ demerit += hd;
+ }
+
+ Real line_y = linear_interpolate (x,
+ attachment_[RIGHT][X_AXIS],
+ attachment_[LEFT][X_AXIS],
+ attachment_[RIGHT][Y_AXIS],
+ attachment_[LEFT][Y_AXIS]);
+
+ if (1) // state.dir_ * state.encompass_infos_[j].get_point (state.dir_) > state.dir_ *line_y )
+ {
+
+ Real closest
+ = 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_back (d);
+ }
+ }