本文整理汇总了C++中item_t::SpinAxisCalculate方法的典型用法代码示例。如果您正苦于以下问题:C++ item_t::SpinAxisCalculate方法的具体用法?C++ item_t::SpinAxisCalculate怎么用?C++ item_t::SpinAxisCalculate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类item_t
的用法示例。
在下文中一共展示了item_t::SpinAxisCalculate方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: splitBinWidth
bool BoxPacker3D::Fit( bin_t bin, item_t item, bin_v_t &bins )
{
// cout << "BoxPacker3D::Fit\n";
// bin->Print();
// item->Print();
if( bin->Fit( item ) )
{
// item fits without rotation
}
else
{
// item does not fit
// try rotating it
item->Spin( 1 );
if( bin->Fit( item ) )
{
//cout << "spin 1";
}
else
{
item->Spin( 1 );
item->Spin( 2 );
if( bin->Fit( item ) )
{
//cout << "spin 2";
}
else
{
item->Spin( 2 );
item->Spin( 3 );
if( bin->Fit( item ) )
{
//cout << "spin 3";
}
else
{
// Does not fit in any orientation
// spin back to original and give up
//cout << "No fit\n";
item->Spin( 3 );
return false;
}
}
}
}
// packing item
bin->set_item(item);
item->setBin( bin->Root( bin )->progid() );
item->setHLocation( bin->getLocationHeight() );
item->setWLocation( bin->getLocationWidth() );
item->setLLocation( bin->getLocationLength() );
item->SpinAxisCalculate();
// item->Print();
splitBinWidth(bin, item);
splitBinHeight(bin, item);
splitBinLength(bin, item);
if (bin->get_x_sub_bin() != NULL)
{
// we have created a new bin from the unused space when the item was added to the bin
// check if this space could be merged with any previously unused space in the user specified bin
if( ! merger( bin, bin->get_x_sub_bin(), bins ) )
{
bins.push_back(bin->get_x_sub_bin());
}
else
{
// unused space was merged, so forget about it
bin->set_x_sub_bin( NULL );
}
}
if (bin->get_y_sub_bin() != NULL)
{
// we have created a new bin from the unused space when the item was added to the bin
// check if this space could be merged with any previously unused space in the user specified bin
if( ! merger( bin, bin->get_y_sub_bin(), bins ) )
{
bins.push_back(bin->get_y_sub_bin());
}
else
{
// unused space was merged, so forget about it
bin->set_y_sub_bin( NULL );
}
}
if (bin->get_z_sub_bin() != NULL)
{
// we have created a new bin from the unused space when the item was added to the bin
//.........这里部分代码省略.........