本文整理汇总了C++中DBbox::overlap方法的典型用法代码示例。如果您正苦于以下问题:C++ DBbox::overlap方法的具体用法?C++ DBbox::overlap怎么用?C++ DBbox::overlap使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DBbox
的用法示例。
在下文中一共展示了DBbox::overlap方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: add
/*! Checks whether a single layout object shape will fit into one of the
childrens quadTree. It calls add() and returns success if the new layout object
fits entirely into one of the possible subtrees or if it blows up its
overlaping area not more than 10%. Returns false if the shape does not fit
anywhere - means it should be placed higher into the quadTree structure.\n
The method might be called recursively via the add() method.
*/
bool laydata::quadTree::fitintree(tdtdata* shape) {
DBbox shovl = shape->overlap();
float clipedarea[4];
// check the clipping to see in witch region to place the shape
for (byte i = 0; i < 4 ; i++) {
DBbox subbox = _overlap.getcorner(i);
clipedarea[i] = subbox.cliparea(shovl,true);
if (-1 == clipedarea[i]) {//entirely inside the area
if (!_quads[i]) _quads[i] = DEBUG_NEW quadTree();
_quads[i]->add(shape);
return true;
}
}
// if we got to this point - means that the shape does not fit
// entirely inside neither of the four sub-areas.
// It is a decision time then
byte candidate = biggest(clipedarea);
// now calculate the eventual new overlaping box
DBbox newovl = _overlap.getcorner(candidate);
newovl.overlap(shovl);
// if the max area of the candidate does not blow more than 10% -
// then seems to be OK to get it
if (newovl.area() < 1.1 * (_overlap.area() / 4)) {
if (!_quads[candidate]) _quads[candidate] = DEBUG_NEW quadTree();
_quads[candidate]->add(shape);
return true;
}
return false; // shape can not be fit into any subtree
}
示例2: biggest
/*! Checks whether a single layout object shape will fit into one of the
childrens quadTree. Returns the index of the child quadTree which fits
the shape or -1 otherwise.
*/
int laydata::quadTree::fitsubtree(DBbox shovl, DBbox* maxsubbox ) {
float clipedarea[4];
// check the clipping to see in witch region to place the shape
for (byte i = 0; i < 4 ; i++) {
clipedarea[i] = maxsubbox[i].cliparea(shovl,true);
if (-1 == clipedarea[i]) {//entirely inside the area
return i;
}
}
// if we got to this point - means that the shape does not fit
// entirely inside neither of the four sub-areas.
// It is a decision time then
byte candidate = biggest(clipedarea);
// now calculate the eventual new overlaping box
DBbox newovl = maxsubbox[candidate];
newovl.overlap(shovl);
// if the max area of the candidate does not blow more than 10% -
// then seems to be OK to get it
if (newovl.area() < 1.1 * (_overlap.area() / 4)) {
return candidate;
}
return -1; // shape can not be fit into any subtree
}