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


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

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


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

示例1: main

// unit test
int main()
{
    // init output code
    int OUTPUT_CODE = 0; // 0 indicates success, 1 is failure

    // create the object
    SurfaceMesh  TM;

    // non-manifold 2-D mesh example
    TM.Reserve_Cells(7);
    TM.Append_Cell(0,1,5);
    TM.Append_Cell(5,2,1);
    TM.Append_Cell(1,5,3);
    TM.Append_Cell(4,5,1);
    TM.Append_Cell(9,6,5);
    TM.Append_Cell(9,5,7);
    TM.Append_Cell(8,9,5);

    // now add the vertex point coordinates
    TM.Init_Points(10);
    TM.Set_Coord(0, -0.5, 0.0,-1.0);
    TM.Set_Coord(1, -1.0, 0.0, 0.0);
    TM.Set_Coord(2, -0.5, 1.0, 0.0);
    TM.Set_Coord(3, -0.5, 0.0, 1.0);
    TM.Set_Coord(4, -0.5,-1.0, 0.0);
    TM.Set_Coord(5,  0.0, 0.0, 0.0);
    TM.Set_Coord(6,  0.5, 0.2, 1.0);
    TM.Set_Coord(7,  0.5,-0.1,-1.0);
    TM.Set_Coord(8,  0.5,-1.0, 0.0);
    TM.Set_Coord(9,  1.0, 0.0, 0.0);

    // now display coordinates
    cout << endl;
    TM.Display_Vtx_Coord();

    // we now stop adding cells
    TM.Finalize_v2hfs_DEBUG();

    // now display the half-facets (attached to vertices) of the intermediate structure 'v2hfs'
    cout << endl;
    TM.Display_v2hfs();

    // check 'v2hfs' against reference data
    VtxHalfFacetType v2hfs_REF[21];
    v2hfs_REF[ 0].Set(1,0,2);
    v2hfs_REF[ 1].Set(2,1,0);
    v2hfs_REF[ 2].Set(3,2,1);
    v2hfs_REF[ 3].Set(4,3,1);
    v2hfs_REF[ 4].Set(5,0,0);
    v2hfs_REF[ 5].Set(5,0,1);
    v2hfs_REF[ 6].Set(5,1,1);
    v2hfs_REF[ 7].Set(5,1,2);
    v2hfs_REF[ 8].Set(5,2,0);
    v2hfs_REF[ 9].Set(5,2,2);
    v2hfs_REF[10].Set(5,3,0);
    v2hfs_REF[11].Set(5,3,2);
    v2hfs_REF[12].Set(6,4,0);
    v2hfs_REF[13].Set(7,5,0);
    v2hfs_REF[14].Set(8,6,1);
    v2hfs_REF[15].Set(9,4,1);
    v2hfs_REF[16].Set(9,4,2);
    v2hfs_REF[17].Set(9,5,1);
    v2hfs_REF[18].Set(9,5,2);
    v2hfs_REF[19].Set(9,6,0);
    v2hfs_REF[20].Set(9,6,2);
    // error check
    const Vtx2HalfFacet_Mapping& c_V2HF_Map = TM.Get_v2hfs();
    const std::vector<VtxHalfFacetType>& c_v2hfs = c_V2HF_Map.Get_VtxMap();
    for (VtxIndType jj = 0; jj < c_v2hfs.size(); ++jj)
        if (!c_v2hfs[jj].Equal(v2hfs_REF[jj]))
        {
            cout << "Intermediate data 'v2hfs' failed!" << endl;
            OUTPUT_CODE = 1;
            break;
        }

    // fill out the sibling half-facet data in 'Cell'
    TM.Build_Sibling_HalfFacets_DEBUG();

    // display that cell connectivity data
    cout << endl;
    TM.Display_Cell();
    cout << endl;

    // check 'Cell' against reference data
    CellSimplexType<2> Cell_REF[7];
    HalfFacetType hf;
    // Cell #1
    Cell_REF[ 0].Set(0,0,hf.Set(1,1));
    Cell_REF[ 0].Set(1,1,hf.Set());
    Cell_REF[ 0].Set(2,5,hf.Set());
    // Cell #2
    Cell_REF[ 1].Set(0,5,hf.Set());
    Cell_REF[ 1].Set(1,2,hf.Set(2,2));
    Cell_REF[ 1].Set(2,1,hf.Set());
    // Cell #3
    Cell_REF[ 2].Set(0,1,hf.Set());
    Cell_REF[ 2].Set(1,5,hf.Set());
    Cell_REF[ 2].Set(2,3,hf.Set(3,0));
//.........这里部分代码省略.........
开发者ID:walkersw,项目名称:AHF,代码行数:101,代码来源:test_2d_non_manifold_2.cpp


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