Real offset = robust_scm2double (prev_offset, 0.0);
Interval rest_extent = rest->extent (rest, Y_AXIS);
- rest_extent.translate (offset + rest->get_parent (Y_AXIS)->relative_coordinate (common_y, Y_AXIS));
+ rest_extent.translate (offset + rest->parent_relative (common_y, Y_AXIS));
Real rest_dim = rest_extent[d];
Real minimum_distance
{
Interval x_ext = fingerings[i]->extent(common[X_AXIS], X_AXIS);
Interval y_ext = fingerings[i]->extent(fingerings[i], Y_AXIS);
- Real parent_y = fingerings[i]->get_parent(Y_AXIS)
- ->relative_coordinate(common[Y_AXIS], Y_AXIS);
+ Real parent_y = fingerings[i]->parent_relative (common[Y_AXIS], Y_AXIS);
// Checking only between sequential neighbors, seems good enough
if (!intersection(x_ext, prev_x_ext).is_empty())
/* We catch PARENT_L_ == nil case with this, but we crash if we did
not ask for the absolute coordinate (ie. REFP == nil.) */
- Real off = get_offset (a);
- if (refp == dim_cache_[a].parent_)
- return off;
- if (dim_cache_[a].parent_ != NULL)
- off += dim_cache_[a].parent_->relative_coordinate (refp, a);
+ return get_offset (a) + parent_relative (refp, a);
+}
- return off;
+Real
+Grob::parent_relative (Grob const *refp, Axis a) const
+{
+ if (Grob *p = get_parent (a))
+ return p->relative_coordinate (refp, a);
+ return 0.0;
}
Real
/* offsets */
void translate_axis (Real, Axis);
Real relative_coordinate (Grob const *refp, Axis) const;
+ Real parent_relative (Grob const *refp, Axis) const;
Real pure_relative_y_coordinate (Grob const *refp, int start, int end);
Real maybe_pure_coordinate (Grob const *refp, Axis a, bool pure, int start, int end);
// skyline will likely be of infinite width anyway
// and we don't want to prematurely trigger H spacing
Real xc = a == X_AXIS || (pure && dynamic_cast<Spanner *> (me))
- ? me->get_parent (X_AXIS)->relative_coordinate (common[X_AXIS], X_AXIS)
+ ? me->parent_relative (common[X_AXIS], X_AXIS)
: me->relative_coordinate (common[X_AXIS], X_AXIS);
// same here, for X_AXIS spacing, if it's happening, it should only be
// before line breaking. because there is no thing as "pure" x spacing,
if (unsmob<Skyline_pair> (sp))
{
Real xc = pure && dynamic_cast<Spanner *> (e)
- ? e->get_parent (X_AXIS)->relative_coordinate (common[X_AXIS], X_AXIS)
+ ? e->parent_relative (common[X_AXIS], X_AXIS)
: e->relative_coordinate (common[X_AXIS], X_AXIS);
// same logic as above
// we assume horizontal spacing is always pure
if (Grob *beam = Stem::get_beam (stems[side]))
(void) beam->get_property ("quantized-positions");
poss[side] = stems[side]->extent (stems[side], Y_AXIS)[get_grob_direction (stems[side])]
- + stems[side]->get_parent (Y_AXIS)->relative_coordinate (commony, Y_AXIS);
+ + stems[side]->parent_relative (commony, Y_AXIS);
}
*dy = poss[RIGHT] - poss[LEFT];