use min_ max_ functions in more places.

also fix minor error in MOD decimate when the modifier did nothing the reported face count would be wrong.
This commit is contained in:
Campbell Barton 2012-10-23 16:21:55 +00:00
parent c623ba5e4b
commit fec81d9b56
29 changed files with 91 additions and 86 deletions

@ -906,8 +906,8 @@ void calc_action_range(const bAction *act, float *start, float *end, short incl_
calc_fcurve_range(fcu, &nmin, &nmax, FALSE, TRUE);
/* compare to the running tally */
min = MIN2(min, nmin);
max = MAX2(max, nmax);
min = min_ff(min, nmin);
max = max_ff(max, nmax);
foundvert = 1;
}
@ -925,10 +925,10 @@ void calc_action_range(const bAction *act, float *start, float *end, short incl_
FMod_Limits *fmd = (FMod_Limits *)fcm->data;
if (fmd->flag & FCM_LIMIT_XMIN) {
min = MIN2(min, fmd->rect.xmin);
min = min_ff(min, fmd->rect.xmin);
}
if (fmd->flag & FCM_LIMIT_XMAX) {
max = MAX2(max, fmd->rect.xmax);
max = max_ff(max, fmd->rect.xmax);
}
}
break;

@ -131,7 +131,7 @@ unsigned int BKE_mask_spline_feather_resolution(MaskSpline *spline, int width, i
if (u_diff > FLT_EPSILON) {
float jump = fabsf(w_diff / u_diff);
max_jump = MAX2(max_jump, jump);
max_jump = max_ff(max_jump, jump);
}
prev_u = point->uw[j].u;

@ -2826,7 +2826,7 @@ ImBuf *BKE_sequencer_give_ibuf(SeqRenderData context, float cfra, int chanshown)
count = BLI_countlist(&ed->metastack);
if ((chanshown < 0) && (count > 0)) {
count = MAX2(count + chanshown, 0);
count = max_ii(count + chanshown, 0);
seqbasep = ((MetaStack *)BLI_findlink(&ed->metastack, count))->oldbasep;
}
else {
@ -3458,7 +3458,7 @@ int BKE_sequence_base_shuffle(ListBase *seqbasep, Sequence *test, Scene *evil_sc
for (seq = seqbasep->first; seq; seq = seq->next) {
if (seq->machine == orig_machine)
new_frame = MAX2(new_frame, seq->enddisp);
new_frame = max_ii(new_frame, seq->enddisp);
}
test->machine = orig_machine;
@ -3483,10 +3483,10 @@ static int shuffle_seq_time_offset_test(ListBase *seqbasep, char dir)
for (seq_other = seqbasep->first; seq_other; seq_other = seq_other->next) {
if (!seq_other->tmp && seq_overlap(seq, seq_other)) {
if (dir == 'L') {
offset = MIN2(offset, seq_other->startdisp - seq->enddisp);
offset = min_ii(offset, seq_other->startdisp - seq->enddisp);
}
else {
offset = MAX2(offset, seq_other->enddisp - seq->startdisp);
offset = max_ii(offset, seq_other->enddisp - seq->startdisp);
}
}
}

@ -221,7 +221,7 @@ void BKE_tracking_get_projection_matrix(MovieTracking *tracking, MovieTrackingOb
float viewfac, pixsize, left, right, bottom, top, clipsta, clipend;
float winmat[4][4];
float ycor = 1.0f / tracking->camera.pixel_aspect;
float shiftx, shifty, winside = MAX2(winx, winy);
float shiftx, shifty, winside = (float)min_ii(winx, winy);
BKE_tracking_camera_shift_get(tracking, winx, winy, &shiftx, &shifty);
@ -2848,10 +2848,10 @@ MovieReconstructContext *BKE_tracking_reconstruction_context_new(MovieTracking *
}
if (first < track->markersnr - 1)
sfra = MIN2(sfra, first_marker->framenr);
sfra = min_ii(sfra, first_marker->framenr);
if (last >= 0)
efra = MAX2(efra, last_marker->framenr);
efra = max_ii(efra, last_marker->framenr);
tracks_map_insert(context->tracks_map, track, NULL);
@ -3198,8 +3198,8 @@ static float stabilization_calculate_autoscale_factor(MovieTracking *tracking, i
if (track->flag & TRACK_USE_2D_STAB ||
((stab->flag & TRACKING_STABILIZE_ROTATION) && track == stab->rot_track))
{
sfra = MIN2(sfra, track->markers[0].framenr);
efra = MAX2(efra, track->markers[track->markersnr - 1].framenr);
sfra = min_ii(sfra, track->markers[0].framenr);
efra = max_ii(efra, track->markers[track->markersnr - 1].framenr);
}
track = track->next;
@ -3643,7 +3643,7 @@ static void channels_segments_calc(MovieTrackingDopesheetChannel *channel)
channel->segments[2 * segment] = start_marker->framenr;
channel->segments[2 * segment + 1] = start_marker->framenr + len;
channel->max_segment = MAX2(channel->max_segment, len);
channel->max_segment = max_ii(channel->max_segment, len);
segment++;
}

@ -810,7 +810,7 @@ BVHTree *BLI_bvhtree_new(int maxsize, float epsilon, char tree_type, char axis)
/* tree epsilon must be >= FLT_EPSILON
* so that tangent rays can still hit a bounding volume..
* this bug would show up when casting a ray aligned with a kdop-axis and with an edge of 2 faces */
epsilon = MAX2(FLT_EPSILON, epsilon);
epsilon = max_ff(FLT_EPSILON, epsilon);
if (tree) {
tree->epsilon = epsilon;
@ -1089,7 +1089,7 @@ BVHTreeOverlap *BLI_bvhtree_overlap(BVHTree *tree1, BVHTree *tree2, unsigned int
data[j] = (BVHOverlapData *)MEM_callocN(sizeof(BVHOverlapData), "BVHOverlapData");
/* init BVHOverlapData */
data[j]->overlap = (BVHTreeOverlap *)malloc(sizeof(BVHTreeOverlap) * MAX2(tree1->totleaf, tree2->totleaf));
data[j]->overlap = (BVHTreeOverlap *)malloc(sizeof(BVHTreeOverlap) * max_ii(tree1->totleaf, tree2->totleaf));
data[j]->tree1 = tree1;
data[j]->tree2 = tree2;
data[j]->max_overlap = MAX2(tree1->totleaf, tree2->totleaf);

@ -475,10 +475,10 @@ bool ExecutionGroup::scheduleAreaWhenPossible(ExecutionSystem *graph, rcti *area
int maxxchunk = ceil((area->xmax - 1) / chunkSizef);
int minychunk = floor(area->ymin / chunkSizef);
int maxychunk = ceil((area->ymax - 1) / chunkSizef);
minxchunk = MAX2(minxchunk, 0);
minychunk = MAX2(minychunk, 0);
maxxchunk = MIN2(maxxchunk, this->m_numberOfXChunks);
maxychunk = MIN2(maxychunk, this->m_numberOfYChunks);
minxchunk = max(minxchunk, 0);
minychunk = max(minychunk, 0);
maxxchunk = min(maxxchunk, this->m_numberOfXChunks);
maxychunk = min(maxychunk, this->m_numberOfYChunks);
bool result = true;
for (indexx = minxchunk; indexx < maxxchunk; indexx++) {

@ -137,10 +137,10 @@ bool NodeOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferOper
first = false;
}
else {
output->xmin = MIN2(output->xmin, tempOutput.xmin);
output->ymin = MIN2(output->ymin, tempOutput.ymin);
output->xmax = MAX2(output->xmax, tempOutput.xmax);
output->ymax = MAX2(output->ymax, tempOutput.ymax);
output->xmin = min(output->xmin, tempOutput.xmin);
output->ymin = min(output->ymin, tempOutput.ymin);
output->xmax = max(output->xmax, tempOutput.xmax);
output->ymax = max(output->ymax, tempOutput.ymax);
}
}
}

@ -65,7 +65,7 @@ void ConvertDepthToRadiusOperation::initExecution()
this->m_aspect = (this->getWidth() > this->getHeight()) ? (this->getHeight() / (float)this->getWidth()) : (this->getWidth() / (float)this->getHeight());
this->m_aperture = 0.5f * (this->m_cam_lens / (this->m_aspect * cam_sensor)) / this->m_fStop;
const float minsz = min(getWidth(), getHeight());
this->m_dof_sp = minsz / ((cam_sensor / 2.0f) / this->m_cam_lens); // <- == aspect * MIN2(img->x, img->y) / tan(0.5f * fov);
this->m_dof_sp = minsz / ((cam_sensor / 2.0f) / this->m_cam_lens); // <- == aspect * min(img->x, img->y) / tan(0.5f * fov);
if (this->m_blurPostOperation) {
m_blurPostOperation->setSigma(min(m_aperture * 128.0f, this->m_maxRadius));

@ -54,10 +54,10 @@ void CropBaseOperation::updateArea()
if (height <= this->m_settings->y2 + 1)
this->m_settings->y2 = height - 1;
this->m_xmax = MAX2(this->m_settings->x1, this->m_settings->x2) + 1;
this->m_xmin = MIN2(this->m_settings->x1, this->m_settings->x2);
this->m_ymax = MAX2(this->m_settings->y1, this->m_settings->y2) + 1;
this->m_ymin = MIN2(this->m_settings->y1, this->m_settings->y2);
this->m_xmax = max(this->m_settings->x1, this->m_settings->x2) + 1;
this->m_xmin = min(this->m_settings->x1, this->m_settings->x2);
this->m_ymax = max(this->m_settings->y1, this->m_settings->y2) + 1;
this->m_ymin = min(this->m_settings->y1, this->m_settings->y2);
}
}

@ -344,28 +344,28 @@ void *DilateStepOperation::initializeTileData(rcti *rect)
for (y = 0; y < bheight; y++) {
for (x = 0; x < bwidth - 1; x++) {
p = rectf + (bwidth * y + x);
*p = MAX2(*p, *(p + 1));
*p = max(*p, *(p + 1));
}
}
for (y = 0; y < bheight; y++) {
for (x = bwidth - 1; x >= 1; x--) {
p = rectf + (bwidth * y + x);
*p = MAX2(*p, *(p - 1));
*p = max(*p, *(p - 1));
}
}
for (x = 0; x < bwidth; x++) {
for (y = 0; y < bheight - 1; y++) {
p = rectf + (bwidth * y + x);
*p = MAX2(*p, *(p + bwidth));
*p = max(*p, *(p + bwidth));
}
}
for (x = 0; x < bwidth; x++) {
for (y = bheight - 1; y >= 1; y--) {
p = rectf + (bwidth * y + x);
*p = MAX2(*p, *(p - bwidth));
*p = max(*p, *(p - bwidth));
}
}
}

@ -190,7 +190,7 @@ void FastGaussianBlurOperation::IIR_gauss(MemoryBuffer *src, float sigma, unsign
} (void)0
// intermediate buffers
sz = MAX2(src_width, src_height);
sz = max(src_width, src_height);
X = (double *)MEM_callocN(sz * sizeof(double), "IIR_gauss X buf");
Y = (double *)MEM_callocN(sz * sizeof(double), "IIR_gauss Y buf");
W = (double *)MEM_callocN(sz * sizeof(double), "IIR_gauss W buf");

@ -257,7 +257,7 @@ void GaussianBlurReferenceOperation::initExecution()
void GaussianBlurReferenceOperation::updateGauss()
{
int i;
int x = MAX2(m_radx, m_rady);
int x = max(m_radx, m_rady);
this->m_maintabs = (float **)MEM_mallocN(x * sizeof(float *), "gauss array");
for (i = 0; i < x; i++) {
m_maintabs[i] = make_gausstab(i + 1);
@ -327,11 +327,11 @@ void GaussianBlurReferenceOperation::executePixel(float output[4], int x, int y,
void GaussianBlurReferenceOperation::deinitExecution()
{
int x, i;
x = MAX2(m_radx, m_rady);
x = max(this->m_radx, this->m_rady);
for (i = 0; i < x; i++) {
MEM_freeN(m_maintabs[i]);
MEM_freeN(this->m_maintabs[i]);
}
MEM_freeN(m_maintabs);
MEM_freeN(this->m_maintabs);
BlurBaseOperation::deinitExecution();
}

@ -28,9 +28,9 @@
#include "BLI_listbase.h"
#include "BLI_math.h"
static int get_pixel_primary_channel(float *pixel)
static int get_pixel_primary_channel(float pixel[3])
{
float max_value = MAX3(pixel[0], pixel[1], pixel[2]);
float max_value = max(max(pixel[0], pixel[1]), pixel[2]);
if (max_value == pixel[0])
return 0;
@ -77,8 +77,8 @@ void KeyingDespillOperation::executePixel(float output[4], float x, float y, Pix
int other_1 = (screen_primary_channel + 1) % 3;
int other_2 = (screen_primary_channel + 2) % 3;
int min_channel = MIN2(other_1, other_2);
int max_channel = MAX2(other_1, other_2);
int min_channel = min(other_1, other_2);
int max_channel = max(other_1, other_2);
float average_value, amount;

@ -28,13 +28,13 @@
#include "BLI_listbase.h"
#include "BLI_math.h"
static int get_pixel_primary_channel(float pixelColor[4])
static int get_pixel_primary_channel(float pixel[3])
{
float max_value = MAX3(pixelColor[0], pixelColor[1], pixelColor[2]);
float max_value = max(max(pixel[0], pixel[1]), pixel[2]);
if (max_value == pixelColor[0])
if (max_value == pixel[0])
return 0;
else if (max_value == pixelColor[1])
else if (max_value == pixel[1])
return 1;
return 2;
@ -45,8 +45,8 @@ static float get_pixel_saturation(float pixelColor[4], float screen_balance, int
int other_1 = (primary_channel + 1) % 3;
int other_2 = (primary_channel + 2) % 3;
int min_channel = MIN2(other_1, other_2);
int max_channel = MAX2(other_1, other_2);
int min_channel = min(other_1, other_2);
int max_channel = max(other_1, other_2);
float val = screen_balance * pixelColor[min_channel] + (1.0f - screen_balance) * pixelColor[max_channel];

@ -198,7 +198,7 @@ void VariableSizeBokehBlurOperation::executeOpenCL(OpenCLDevice *device,
cl_float scalar = this->m_do_size_scale ? (max_dim / 100.0f) : 1.0f;
maxBlur = (cl_int)sizeMemoryBuffer->getMaximumValue() * scalar;
maxBlur = MIN2(maxBlur, this->m_maxBlur);
maxBlur = min(maxBlur, this->m_maxBlur);
device->COM_clAttachMemoryBufferToKernelParameter(defocusKernel, 0, -1, clMemToCleanUp, inputMemoryBuffers, this->m_inputProgram);
device->COM_clAttachMemoryBufferToKernelParameter(defocusKernel, 1, -1, clMemToCleanUp, inputMemoryBuffers, this->m_inputBokehProgram);

@ -34,6 +34,7 @@
#include "BLI_utildefines.h"
#include "BLI_rect.h"
#include "BLI_lasso.h"
#include "BLI_math.h"
#include "BKE_context.h"
#include "BKE_mask.h"
@ -622,7 +623,7 @@ static int circle_select_exec(bContext *C, wmOperator *op)
/* compute ellipse and position in unified coordinates */
ED_mask_get_size(sa, &width, &height);
ED_mask_zoom(sa, ar, &zoomx, &zoomy);
width = height = MAX2(width, height);
width = height = max_ii(width, height);
ellipse[0] = width * zoomx / radius;
ellipse[1] = height * zoomy / radius;

@ -505,7 +505,7 @@ static int loopcut_modal(bContext *C, wmOperator *op, wmEvent *event)
if (event->val == KM_RELEASE)
break;
cuts = MAX2(cuts - 1, 0);
cuts = max_ii(cuts - 1, 0);
RNA_int_set(op->ptr, "number_cuts", cuts);
ringsel_find_edge(lcd, cuts);
show_cuts = TRUE;

@ -1062,7 +1062,7 @@ static void vgroup_normalize(Object *ob)
dw = defvert_find_index(dv, def_nr);
if (dw) {
weight_max = MAX2(dw->weight, weight_max);
weight_max = max_ff(dw->weight, weight_max);
}
}

@ -368,7 +368,7 @@ static Scene *preview_prepare_scene(Scene *scene, ID *id, int id_type, ShaderPre
if (OB_TYPE_SUPPORT_MATERIAL(base->object->type)) {
/* don't use assign_material, it changed mat->id.us, which shows in the UI */
Material ***matar = give_matarar(base->object);
int actcol = MAX2(base->object->actcol - 1, 0);
int actcol = max_ii(base->object->actcol - 1, 0);
if (matar && actcol < base->object->totcol)
(*matar)[actcol] = mat;
@ -518,8 +518,8 @@ static int ed_preview_draw_rect(ScrArea *sa, Scene *sce, ID *id, int split, int
if (ABS(rres.rectx - newx) < 2 && ABS(rres.recty - newy) < 2) {
newrect->xmax = MAX2(newrect->xmax, rect->xmin + rres.rectx + offx);
newrect->ymax = MAX2(newrect->ymax, rect->ymin + rres.recty);
newrect->xmax = max_ii(newrect->xmax, rect->xmin + rres.rectx + offx);
newrect->ymax = max_ii(newrect->ymax, rect->ymin + rres.recty);
if (rres.rectx && rres.recty) {
/* temporary conversion to byte for drawing */

@ -173,7 +173,7 @@ typedef struct ImagePaintState {
} ImagePaintState;
typedef struct ImagePaintPartialRedraw {
int x1, y1, x2, y2;
int x1, y1, x2, y2; /* XXX, could use 'rcti' */
int enabled;
} ImagePaintPartialRedraw;
@ -3583,11 +3583,11 @@ static int partial_redraw_array_merge(ImagePaintPartialRedraw *pr, ImagePaintPar
{
int touch = 0;
while (tot--) {
pr->x1 = MIN2(pr->x1, pr_other->x1);
pr->y1 = MIN2(pr->y1, pr_other->y1);
pr->x1 = min_ii(pr->x1, pr_other->x1);
pr->y1 = min_ii(pr->y1, pr_other->y1);
pr->x2 = MAX2(pr->x2, pr_other->x2);
pr->y2 = MAX2(pr->y2, pr_other->y2);
pr->x2 = max_ii(pr->x2, pr_other->x2);
pr->y2 = max_ii(pr->y2, pr_other->y2);
if (pr->x2 != -1)
touch = 1;
@ -4222,10 +4222,10 @@ static void imapaint_dirty_region(Image *ima, ImBuf *ibuf, int x, int y, int w,
imapaintpartial.enabled = 1;
}
else {
imapaintpartial.x1 = MIN2(imapaintpartial.x1, x);
imapaintpartial.y1 = MIN2(imapaintpartial.y1, y);
imapaintpartial.x2 = MAX2(imapaintpartial.x2, x + w);
imapaintpartial.y2 = MAX2(imapaintpartial.y2, y + h);
imapaintpartial.x1 = min_ii(imapaintpartial.x1, x);
imapaintpartial.y1 = min_ii(imapaintpartial.y1, y);
imapaintpartial.x2 = max_ii(imapaintpartial.x2, x + w);
imapaintpartial.y2 = max_ii(imapaintpartial.y2, y + h);
}
w = ((x + w - 1) >> IMAPAINT_TILE_BITS);

@ -39,6 +39,7 @@
#include "BLI_string.h"
#include "BLI_dynstr.h"
#include "BLI_utildefines.h"
#include "BLI_math.h"
#include "BKE_context.h"
#include "BKE_text.h" /* only for character utility funcs */
@ -904,8 +905,8 @@ static int console_copy_exec(bContext *C, wmOperator *UNUSED(op))
for (cl = sc->scrollback.first; cl; cl = cl->next) {
if (sel[0] <= cl->len && sel[1] >= 0) {
int sta = MAX2(sel[0], 0);
int end = MIN2(sel[1], cl->len);
int sta = max_ii(sel[0], 0);
int end = min_ii(sel[1], cl->len);
if (BLI_dynstr_get_len(buf_dyn))
BLI_dynstr_append(buf_dyn, "\n");

@ -1240,8 +1240,8 @@ static void draw_seq_strips(const bContext *C, Editing *ed, ARegion *ar)
/* boundbox and selection tests for NOT drawing the strip... */
if ((seq->flag & SELECT) != sel) continue;
else if (seq == last_seq) continue;
else if (MIN2(seq->startdisp, seq->start) > v2d->cur.xmax) continue;
else if (MAX2(seq->enddisp, seq->start + seq->len) < v2d->cur.xmin) continue;
else if (min_ii(seq->startdisp, seq->start) > v2d->cur.xmax) continue;
else if (max_ii(seq->enddisp, seq->start + seq->len) < v2d->cur.xmin) continue;
else if (seq->machine + 1.0f < v2d->cur.ymin) continue;
else if (seq->machine > v2d->cur.ymax) continue;

@ -1952,7 +1952,7 @@ static int sequencer_meta_make_exec(bContext *C, wmOperator *op)
while (seq) {
next = seq->next;
if (seq != seqm && (seq->flag & SELECT)) {
channel_max = MAX2(seq->machine, channel_max);
channel_max = max_ii(seq->machine, channel_max);
BLI_remlink(ed->seqbasep, seq);
BLI_addtail(&seqm->seqbase, seq);
}
@ -2255,11 +2255,11 @@ static int sequencer_view_selected_exec(bContext *C, wmOperator *UNUSED(op))
for (seq = ed->seqbasep->first; seq; seq = seq->next) {
if (seq->flag & SELECT) {
xmin = MIN2(xmin, seq->startdisp);
xmax = MAX2(xmax, seq->enddisp);
xmin = min_ii(xmin, seq->startdisp);
xmax = max_ii(xmax, seq->enddisp);
ymin = MIN2(ymin, seq->machine);
ymax = MAX2(ymax, seq->machine);
ymin = min_ii(ymin, seq->machine);
ymax = max_ii(ymax, seq->machine);
}
}

@ -1223,7 +1223,7 @@ static void view3d_panel_object(const bContext *C, Panel *pa)
if (ob == NULL)
return;
lim = 10000.0f * MAX2(1.0f, v3d->grid);
lim = 10000.0f * max_ff(1.0f, v3d->grid);
block = uiLayoutGetBlock(pa->layout);
uiBlockSetHandleFunc(block, do_view3d_region_buttons, NULL);

@ -2868,8 +2868,8 @@ static int view3d_main_area_draw_engine(const bContext *C, ARegion *ar, int draw
/* clamp small tile sizes to prevent inefficient threading utilization
* the same happens for final renders as well
*/
engine->tile_x = MAX2(engine->tile_x, 64);
engine->tile_y = MAX2(engine->tile_x, 64);
engine->tile_x = max_ii(engine->tile_x, 64);
engine->tile_y = max_ii(engine->tile_x, 64);
type->view_update(engine, C);

@ -3988,7 +3988,7 @@ static void p_smooth(PChart *chart)
diff[1] = p[1] - oldp[1];
length = sqrt(diff[0] * diff[0] + diff[1] * diff[1]);
d = MAX2(d, length);
d = max_ff(d, length);
moved += length;
}
}

@ -106,6 +106,9 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
TIMEIT_START(decim);
#endif
/* set up front so we dont show invalid info in the UI */
dmd->face_count = dm->getNumPolys(dm);
switch (dmd->mode) {
case MOD_DECIM_MODE_COLLAPSE:
if (dmd->percent == 1.0f) {
@ -124,7 +127,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
break;
}
if (dm->getNumPolys(dm) <= 3) {
if (dmd->face_count <= 3) {
modifier_setError(md, "%s", TIP_("Modifier requires more than 3 input faces"));
return dm;
}

@ -1579,7 +1579,7 @@ static PyObject *Matrix_str(MatrixObject *self)
maxsize[col] = 0;
for (row = 0; row < self->num_row; row++) {
int size = BLI_snprintf(dummy_buf, sizeof(dummy_buf), "%.4f", MATRIX_ITEM(self, row, col));
maxsize[col] = MAX2(maxsize[col], size);
maxsize[col] = max_ii(maxsize[col], size);
}
}

@ -348,12 +348,12 @@ int rtbuild_heuristic_object_split(RTBuilder *b, int nchilds)
sweep[i].cost = obj[i]->cost;
}
else {
sweep[i].bb[0] = MIN2(obj[i]->bb[0], sweep[i + 1].bb[0]);
sweep[i].bb[1] = MIN2(obj[i]->bb[1], sweep[i + 1].bb[1]);
sweep[i].bb[2] = MIN2(obj[i]->bb[2], sweep[i + 1].bb[2]);
sweep[i].bb[3] = MAX2(obj[i]->bb[3], sweep[i + 1].bb[3]);
sweep[i].bb[4] = MAX2(obj[i]->bb[4], sweep[i + 1].bb[4]);
sweep[i].bb[5] = MAX2(obj[i]->bb[5], sweep[i + 1].bb[5]);
sweep[i].bb[0] = min_ff(obj[i]->bb[0], sweep[i + 1].bb[0]);
sweep[i].bb[1] = min_ff(obj[i]->bb[1], sweep[i + 1].bb[1]);
sweep[i].bb[2] = min_ff(obj[i]->bb[2], sweep[i + 1].bb[2]);
sweep[i].bb[3] = max_ff(obj[i]->bb[3], sweep[i + 1].bb[3]);
sweep[i].bb[4] = max_ff(obj[i]->bb[4], sweep[i + 1].bb[4]);
sweep[i].bb[5] = max_ff(obj[i]->bb[5], sweep[i + 1].bb[5]);
sweep[i].cost = obj[i]->cost + sweep[i + 1].cost;
}
// right_cost += obj[i]->cost;