本文整理汇总了C++中item_t::side_2方法的典型用法代码示例。如果您正苦于以下问题:C++ item_t::side_2方法的具体用法?C++ item_t::side_2怎么用?C++ item_t::side_2使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类item_t
的用法示例。
在下文中一共展示了item_t::side_2方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: sub_binY
void BoxPacker3D::splitBinHeight(bin_t bin, item_t item)
{
map<string, double> sides = findSubBinSizes( bin, item );
double dy_w = sides["dy_w"];
double dy_h = sides["dy_h"];
double dy_l = sides["dy_l"];
if (dy_h <= 0)
bin->set_y_sub_bin(NULL);
else
{
bin_t sub_binY( new Bin3D() );
sub_binY->set_side_1(bin->side_1()->size_side_to(dy_w));
sub_binY->set_side_2(bin->side_2()->size_side_to(dy_h));
sub_binY->set_side_3(bin->side_3()->size_side_to(dy_l));
sub_binY->set_parent_bin(bin);
sub_binY->set_id(bin->id());
sub_binY->setLocationHeight( bin->getLocationHeight() + item->side_2()->size() );
sub_binY->setLocationWidth( bin->getLocationWidth() );
sub_binY->setLocationLength( bin->getLocationLength() );
bin->set_y_sub_bin(sub_binY);
}
}
示例2: if
map<string, double> BoxPacker3D::findSubBinSizes( bin_t bin, item_t item)
{
double w_diff = bin->side_1()->size() - item->side_1()->size();
double h_diff = bin->side_2()->size() - item->side_2()->size();
double l_diff = bin->side_3()->size() - item->side_3()->size();
double dx_w, dx_h, dx_l;
double dy_w, dy_h, dy_l;
double dz_w, dz_h, dz_l;
if (l_diff >= w_diff && w_diff >= h_diff)
{
dx_w = bin->side_1()->size() - item->side_1()->size();
dx_h = item->side_2()->size();
dx_l = bin->side_3()->size();
dy_w = bin->side_1()->size();
dy_h = bin->side_2()->size() - item->side_2()->size();
dy_l = bin->side_3()->size();
dz_w = item->side_1()->size();
dz_h = item->side_2()->size();
dz_l = bin->side_3()->size() - item->side_3()->size();
}
else if (l_diff >= h_diff && h_diff >= w_diff)
{
dx_w = bin->side_1()->size() - item->side_1()->size();
dx_h = bin->side_2()->size();
dx_l = bin->side_3()->size();
dy_w = item->side_1()->size();
dy_h = bin->side_2()->size() - item->side_2()->size();
dy_l = bin->side_3()->size();
dz_w = item->side_1()->size();
dz_h = item->side_2()->size();
dz_l = bin->side_3()->size() - item->side_3()->size();
}
else if (w_diff >= h_diff && h_diff >= l_diff)
{
dx_w = bin->side_1()->size() - item->side_1()->size();
dx_h = item->side_2()->size();
dx_l = item->side_3()->size();
dy_w = bin->side_1()->size();
dy_h = bin->side_2()->size() - item->side_2()->size();
dy_l = item->side_3()->size();
dz_w = bin->side_1()->size();
dz_h = bin->side_2()->size();
dz_l = bin->side_3()->size() - item->side_3()->size();
}
else if (w_diff >= l_diff && l_diff >= h_diff)
{
dx_w = bin->side_1()->size() - item->side_1()->size();
dx_h = item->side_2()->size();
dx_l = item->side_3()->size();
dy_w = bin->side_1()->size();
dy_h = bin->side_2()->size() - item->side_2()->size();
dy_l = bin->side_3()->size();
dz_w = bin->side_1()->size();
dz_h = item->side_2()->size();
dz_l = bin->side_3()->size() - item->side_3()->size();
}
else if (h_diff >= w_diff && w_diff >= l_diff)
{
dx_w = bin->side_1()->size() - item->side_1()->size();
dx_h = bin->side_2()->size();
dx_l = item->side_3()->size();
dy_w = item->side_1()->size();
dy_h = bin->side_2()->size() - item->side_2()->size();
dy_l = item->side_3()->size();
dz_w = bin->side_1()->size();
dz_h = bin->side_2()->size();
dz_l = bin->side_3()->size() - item->side_3()->size();
}
else if (h_diff >= l_diff && l_diff >= w_diff)
{
dx_w = bin->side_1()->size() - item->side_1()->size();
dx_h = bin->side_2()->size();
dx_l = bin->side_3()->size();
dy_w = item->side_1()->size();
dy_h = bin->side_2()->size() - item->side_2()->size();
dy_l = item->side_3()->size();
//.........这里部分代码省略.........