本文整理汇总了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;
}