当前位置: 首页>>代码示例>>C++>>正文


C++ DBbox::overlap方法代码示例

本文整理汇总了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
}
开发者ID:BackupTheBerlios,项目名称:toped-svn,代码行数:36,代码来源:quadtree.cpp

示例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
}
开发者ID:BackupTheBerlios,项目名称:toped-svn,代码行数:27,代码来源:quadtree.cpp


注:本文中的DBbox::overlap方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。