/* Last edited on 2018-07-02 02:22:09 by stolfilocal */ void mfc_place_subfigure(r2_t *sMin, r2_t *sMax, r2_t *org, r2_t *fMin, r2_t *fMax); /* Chooses a placement for an additional subfigure in a figure with multiple sub_figures. Currently, just stacks the sub-figure atop the other figures. Assumes that {*sMin,*sMax} is the bounding box of the sub-figure relative to its center, including any safety margins; and {*fMin,*fMax} is the bounding box of all sub-figures already added, relative to the figure's origin. Returns in {*org} the position of the sub-figure's origin relative to the figure's origin. Also updates {*fMin,*fMax}. */ void mfc_place_subfigure(r2_t *sMin, r2_t *sMax, r2_t *org, r2_t *fMin, r2_t *fMax) { r2_t tMin = (r2_t){{ fMin->c[0], fMax->c[1] }}; /* Upper left corner of current figure. */ r2_sub(&tMin, sMin, org); r2_t tMax; /* Upper right corner of subfigure rel to figure origin. */ r2_add(org, sMax, &tMax); for (int j = 0; j < 2; j++) { if (tMax.c[j] > fMax->c[j]) { fMax->c[j] = tMax.c[j]; } } }