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


C++ SurfaceMesh::Is_Connected方法代码示例

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


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

示例1: main


//.........这里部分代码省略.........
    non_manifold_hf_REF[1].Set(6,0);
    std::vector<HalfFacetType> non_manifold_hf;
    TM.Get_Nonmanifold_HalfFacets(non_manifold_hf);
    for (unsigned int jj = 0; jj < non_manifold_hf.size(); ++jj)
        if (!non_manifold_hf[jj].Equal(non_manifold_hf_REF[jj]))
        {
            cout << "Non-manifold facet data is incorrect!" << endl;
            OUTPUT_CODE = 10;
            break;
        }

    // display non-manifold vertices
    TM.Display_Nonmanifold_Vertices();
    cout << endl;

    // check non-manifold vertices against reference data
    const VtxIndType non_manifold_vtx_REF[1] = {5};
    std::vector<VtxIndType> non_manifold_vtx;
    TM.Get_Nonmanifold_Vertices(non_manifold_vtx);
    for (unsigned int jj = 0; jj < non_manifold_vtx.size(); ++jj)
        if (non_manifold_vtx[jj]!=non_manifold_vtx_REF[jj])
        {
            cout << "Non-manifold vertex data is incorrect!" << endl;
            OUTPUT_CODE = 11;
            break;
        }

    TM.Display_Unique_Vertices();
    cout << endl;

    // check unique vertices against reference data
    std::vector<VtxIndType> uv;
    TM.Get_Unique_Vertices(uv);
    const VtxIndType uv_REF[10] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
    for (unsigned int jj = 0; jj < uv.size(); ++jj)
        if (uv[jj]!=uv_REF[jj])
        {
            cout << "Unique vertex data is incorrect!" << endl;
            OUTPUT_CODE = 12;
            break;
        }

    // display all edges in the mesh
    std::vector<MeshEdgeType> edges;
    TM.Get_Edges(edges);
    cout << "A unique list of edges in the mesh:" << endl;
    std::vector<MeshEdgeType>::const_iterator it;
    for (it = edges.begin(); it!=edges.end(); ++it)
    {
        cout << "[" << (*it).vtx[0] << ", " << (*it).vtx[1] << "]" << endl;
    }
    cout << endl;

    // test if a pair of vertices is connected by an edge
    cout << "Vtx #5 and Vtx #9 are connected." << endl;
    if (!TM.Is_Connected(5, 9))
    {
        cout << "Incorrect!  They are NOT connected!" << endl;
        OUTPUT_CODE = 13;
    }
    // test if a pair of vertices is connected by an edge
    cout << "Vtx #7 and Vtx #2 are NOT connected." << endl;
    if (TM.Is_Connected(7, 2))
    {
        cout << "Incorrect!  They ARE connected!" << endl;
        OUTPUT_CODE = 14;
    }
    cout << endl;

    // display all cells attached to an edge
    std::vector<CellIndType> attached_cells;
    MeshEdgeType EE;
    EE.Set(1,5);
    TM.Get_Cells_Attached_To_Edge(EE, attached_cells);
    cout << "Here are the cell indices of cells attached to the edge [1, 5]:" << endl;
    std::vector<CellIndType>::const_iterator ic;
    for (ic = attached_cells.begin(); ic!=attached_cells.end(); ++ic)
        cout << "Cell #" << (*ic) << endl;
    cout << endl;

    // display the free boundary
    std::vector<HalfFacetType> free_bdy;
    TM.Get_FreeBoundary(free_bdy);
    cout << "Here are the half-facets that lie on the free boundary:" << endl;
    std::vector<HalfFacetType>::const_iterator hfi;
    for (hfi = free_bdy.begin(); hfi!=free_bdy.end(); ++hfi)
    {
        (*hfi).Print();
        cout << endl;
    }
    cout << endl;

    if (OUTPUT_CODE==0)
        cout << "Unit test is successful!" << endl;
    else
        cout << "Unit test failed!" << endl;
    cout << endl;

    return OUTPUT_CODE;
}
开发者ID:walkersw,项目名称:AHF,代码行数:101,代码来源:test_2d_non_manifold_2.cpp


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