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


C++ Topology::addPoint方法代码示例

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


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

示例1: openProject

void ProjectManager::openProject(const std::string &path, Topology& topology)
{
    ifstream inputFile;
    inputFile.open(path);
    //TODO: ellenorizni
    if(inputFile.fail()){
        //ERROR
        return;
    }
    InputState state = PATH_;
    string line;
    std::istringstream iss;
    char c;
    int n, i;
    unsigned int id, current_id, pointId1, pointId2, pointId3, pointId4, edgeId1, edgeId2, edgeId3, edgeId4;
    float posX, posY, posZ, normX, normY, normZ;
    //Read model path
    getline(inputFile, line);
    string modelPath = line;

    //Read points
    getline(inputFile, line);
    iss = istringstream(line);
    iss >> c >> n >> current_id;
    printf("read points: %d \n", n);
    TopologyPoint::current_id = current_id;
    for(i = 0; i < n; i++){
        getline(inputFile, line);
        iss = istringstream(line);
        iss >> id >> posX >> posY >> posZ >> normX >> normY >> normZ;
        TopologyPoint point(id);
        point.setPosition(posX, posY, posZ);
        point.setNormal(normX, normY, normZ);
        topology.addPoint(point);
    }

    //Read edges
    getline(inputFile, line);
    iss = istringstream(line);
    iss >> c >> n >> current_id;
    printf("read edges: %d \n", n);
    TopologyEdge::current_id = current_id;
    for(i = 0; i < n; i++){
        getline(inputFile, line);
        iss = istringstream(line);
        iss >> id >> pointId1 >> pointId2;
        TopologyEdge edge(id, pointId1, pointId2);
        topology.addEdge(edge);
    }

    //Read triangles
    getline(inputFile, line);
    iss = istringstream(line);
    iss >> c >> n >> current_id;
    printf("read triangles: %d \n", n);
    TopologyHelperTriangle::current_id = current_id;
    for(i = 0; i < n; i++){
        getline(inputFile, line);
        iss = istringstream(line);
        iss >> id >> pointId1 >> pointId2 >> pointId3 >> edgeId1 >> edgeId2 >> edgeId3;
        TopologyHelperTriangle triangle(id, pointId1, pointId2, pointId3, edgeId1, edgeId2, edgeId3);
        topology.addTriangle(triangle);
    }

    //Read quads
    getline(inputFile, line);
    iss = istringstream(line);
    iss >> c >> n >> current_id;
    printf("read quads: %d \n", n);
    TopologyHelperQuad::current_id = current_id;
    for(i = 0; i < n; i++){
        getline(inputFile, line);
        iss = istringstream(line);
        iss >> id >> pointId1 >> pointId2 >> pointId3 >> pointId4 >> edgeId1 >> edgeId2 >> edgeId3 >> edgeId4;
        TopologyHelperQuad quad(id, pointId1, pointId2, pointId3, pointId4, edgeId1, edgeId2, edgeId3, edgeId4);
        topology.addQuad(quad);
    }

}
开发者ID:nacsa,项目名称:Retopology,代码行数:79,代码来源:projectmanager.cpp


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