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


C++ Bedge::do_swap方法代码示例

本文整理汇总了C++中Bedge::do_swap方法的典型用法代码示例。如果您正苦于以下问题:C++ Bedge::do_swap方法的具体用法?C++ Bedge::do_swap怎么用?C++ Bedge::do_swap使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Bedge的用法示例。


在下文中一共展示了Bedge::do_swap方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: assert

bool
Skin::correct_face(Bface* f, bool& changed)
{
   //                                 
   //  BBBBBBBBBBBBBBB                
   //  B            /|                
   //  B          /  |                
   //  B   f    /    |   Change this, where quad face f        
   //  B      /      |   is adjacent to 2 boundary edgees...
   //  B    /        |                
   //  B  /          |                
   //  B/- - - - - - o                
   //                                 
   //  BBBBBBBBBBBBBBB                
   //  B\            |                
   //  B  \          |                
   //  B    \        |  ... to this, where neither face of
   //  B      \      |  the quad is adjacent to more than 1              
   //  B        \    |  boundary edge.              
   //  B          \  |                
   //  B - - - - - - o                
   //                                 

   assert(f);

   // boundary edges have flag == 1, others have flag == 0
   uint n = num_edge_flags_set(f);
   if (n < 2) return true;      // not a problem
   if (n > 2) {
      // unfixable problem
      err_adv(debug, "  can't fix face with %d boundary edges", n);
      return false;
   }

   // 2 boundary edges; get the non-boundary one:
   Bedge* e = boundary_connector(f);
   assert(e);

   // we want to swap it; only possible if it has 2 faces:
   if (e->nfaces() != 2) {
      err_adv(debug, "  can't fix edge with %d faces", e->nfaces());
      return false;
   }

   // swapping won't do any good if its other face has boundary edges too:
   if (!(num_edge_flags_set(e->f1()) == 0 || num_edge_flags_set(e->f2()) == 0)) {
      err_adv(debug, "  unfixable edge found, giving up");
      return false;
   }

   // try to swap it:
   if (e->do_swap()) {
      err_adv(debug, "  swapped edge");
      return changed = true;
   }
   err_adv(debug, "  edge swap failed");
   return false;
}
开发者ID:ArnaudGastinel,项目名称:jot-lib,代码行数:58,代码来源:skin.C


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