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


C++ Boundary::edges_begin方法代码示例

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


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

示例1: dump_contours

void dump_contours (std::ostream &os, const Boundary &a, int flags) {
    Boundary::contour_iterator cit;
    Boundary::edge_iterator eit, eit_end;
    for (cit = a.contours_begin (); cit != a.contours_end (); ++cit) {
        if (flags & BY_DIRECTION) {
            if (total_inflection_for_contour (a, cit) < 0)
                continue;
        }
        eit = a.edges_begin (cit);
        eit_end = a.edges_end (cit);
        ++eit_end;
        for (; eit != eit_end; ++eit) {
            dump_vertex (os, eit->vert0, a);
        }
        os << "\n"; // contour sep. (for gnuplot)
    }
    os << "\n"; // index sep. (for gnuplot)
    if (! (flags & BY_DIRECTION))
        return;
    for (cit = a.contours_begin (); cit != a.contours_end (); ++cit) {
        if (flags & BY_DIRECTION) {
            if (total_inflection_for_contour (a, cit) > 0)
                continue;
        }
        eit = a.edges_begin (cit);
        eit_end = a.edges_end (cit);
        ++eit_end;
        for (; eit != eit_end; ++eit) {
            dump_vertex (os, eit->vert0, a);
        }
        os << "\n"; // contour sep. (for gnuplot)
    }
    os << "\n"; // index sep. (for gnuplot)
}
开发者ID:mapleyustat,项目名称:papaya,代码行数:34,代码来源:util.cpp

示例2: total_inflection_for_contour_unchecked

static
double total_inflection_for_contour_unchecked (
    const Boundary &b, Boundary::contour_iterator cit)
{
    Boundary::edge_iterator eit = b.edges_begin (cit),
        eit_end = b.edges_end (cit);
    double acc = 0.;
    for (; eit != eit_end; ++eit)
        acc += b.inflection_after_edge (eit);
    return acc;
}
开发者ID:mapleyustat,项目名称:papaya,代码行数:11,代码来源:util.cpp

示例3: total_inflection_for_contour

double total_inflection_for_contour (const Boundary &b,
    Boundary::contour_iterator cit)
{
    double acc = total_inflection_for_contour_unchecked (b, cit);
    // total inflection should be +/-2pi.
    if (! (fabs (fabs (acc) - 2*M_PI) < 1e-3)) {
        Boundary::edge_iterator eit = b.edges_begin (cit),
            eit_end = b.edges_end (cit);
        int ctr = 0;
        for (eit = b.edges_begin (cit); eit != eit_end; ++eit) {
            vec_t v0 = b.edge_vertex0 (eit);
            vec_t v1 = b.edge_vertex1 (eit);
            fprintf (stderr, "infl at edge %.4i = %f\n"
                "(%f,%f) (%f,%f)\n", ctr++,
                b.inflection_after_edge (eit),
                v0[0], v0[1], v1[0], v1[1]);
        }
        die ("total_inflection_for_contour (contour_id = %i):\n%.20e\n%.20e",
            *cit, acc, 2*M_PI);
    }
    return acc;
}
开发者ID:mapleyustat,项目名称:papaya,代码行数:22,代码来源:util.cpp

示例4: assert_boundary

// perform sanity checking on a Boundary.
// this is not public code for now.
static void assert_boundary (const Boundary &b) {
#ifndef NDEBUG
    Boundary::contour_iterator cit;
    for (cit = b.contours_begin (); cit != b.contours_end (); ++cit) {
        Boundary::edge_iterator eit     = b.edges_begin (cit),
                                eit_end = b.edges_end (cit);
        while (eit != eit_end) {
            Boundary::edge_iterator next_eit = eit;
            ++next_eit;
            if (! (normed_diff (b.edge_vertex1 (eit),
                                b.edge_vertex0 (next_eit))
                   < VERTEX_MERGE_TOLERANCE)) {
                die ("assert_boundary: contour is not continuous.");
            }

            eit = next_eit;
        }
    }
#endif // NDEBUG
}
开发者ID:mapleyustat,项目名称:papaya,代码行数:22,代码来源:util.cpp


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