Mesh_feature_extractor没有返回正确的边框

时间:2017-07-13 06:21:41

标签: cgal

我可能不了解Mesh_feature_extractor边框是如何工作的。我正在使用一个带有8个顶点的完美立方体,当我调用get_nb_borders()时它返回1,我认为这是错误的(也许我对'Border'的理解是错误的)。谁能解释边界是什么?

    std::vector<Vector3> tempVertices;
    tempVertices.push_back(Vector3(-50, 50, -50));
    tempVertices.push_back(Vector3(-50, 50, 50));
    tempVertices.push_back(Vector3(50, 50, 50));
    tempVertices.push_back(Vector3(50, 50, -50));

    tempVertices.push_back(Vector3(-50, -50, -50));
    tempVertices.push_back(Vector3(-50, -50, 50));
    tempVertices.push_back(Vector3(50, -50, 50));
    tempVertices.push_back(Vector3(50, -50, -50));

    std::vector<int32> tempIndices;
    tempIndices.push_back(0);   tempIndices.push_back(2);   tempIndices.push_back(1);
    tempIndices.push_back(0);   tempIndices.push_back(3);   tempIndices.push_back(2);

    tempIndices.push_back(4);   tempIndices.push_back(6);   tempIndices.push_back(5);
    tempIndices.push_back(4);   tempIndices.push_back(7);   tempIndices.push_back(6);

    tempIndices.push_back(4);   tempIndices.push_back(3);   tempIndices.push_back(0);
    tempIndices.push_back(4);   tempIndices.push_back(7);   tempIndices.push_back(3);

    tempIndices.push_back(7);   tempIndices.push_back(2);   tempIndices.push_back(3);
    tempIndices.push_back(7);   tempIndices.push_back(6);   tempIndices.push_back(2);

    tempIndices.push_back(6);   tempIndices.push_back(1);   tempIndices.push_back(2);
    tempIndices.push_back(6);   tempIndices.push_back(5);   tempIndices.push_back(1);

    tempIndices.push_back(5);   tempIndices.push_back(0);   tempIndices.push_back(1);
    tempIndices.push_back(5);   tempIndices.push_back(4);   tempIndices.push_back(0);

    typedef Polyhedron::HalfedgeDS  HalfedgeDS;

    Polyhedron mesh;
    CGALTriangleBuilder<HalfedgeDS> triangle(tempVertices, tempIndices);
    mesh.delegate(triangle);

    typedef CGAL::Parameterization_polyhedron_adaptor_3<Polyhedron> Parameterization_polyhedron_adaptor;
    Parameterization_polyhedron_adaptor mesh_adaptor(mesh);

    // Helper class to compute genus or extract borders
    typedef CGAL::Parameterization_mesh_feature_extractor<Parameterization_polyhedron_adaptor> Mesh_feature_extractor;


    // Extract mesh borders and compute genus
    Mesh_feature_extractor feature_extractor(mesh_adaptor);
    int nb_borders = feature_extractor.get_nb_borders();
    int genus = feature_extractor.get_genus();

1 个答案:

答案 0 :(得分:0)

我立方体的坏脸是顺时针方向,休息是逆时针方向......