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


C++ Graph::ExtractPrimitives方法代码示例

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


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

示例1: determine_faces_from_edges

IndexArrayPtr PGL::determine_faces_from_edges(const Point2ArrayPtr& points, const std::vector<std::pair<uint32_t, uint32_t> >& edges)
{
	typedef Wm5::PlanarGraph<Vector2> Graph;
	Graph graph;
	int i = 0;
	for (Point2Array::const_iterator it = points->begin(); it != points->end(); ++it)
		graph.InsertVertex(*it,i++);
	for (std::vector<std::pair<uint32_t, uint32_t> >::const_iterator itedge = edges.begin(); itedge != edges.end(); ++itedge)
		graph.InsertEdge(itedge->first,itedge->second);

	std::vector<Graph::Primitive*> mPrimitives;
	graph.ExtractPrimitives(mPrimitives);


	IndexArrayPtr result(new IndexArray());
	for (std::vector<Graph::Primitive*>::const_iterator itPrim = mPrimitives.begin(); itPrim != mPrimitives.end(); ++itPrim){
		if ((*itPrim)->Type == Graph::PT_MINIMAL_CYCLE){
			Index lresult;
			for (std::vector<std::pair<Vector2,int> >::const_iterator itSequence = (*itPrim)->Sequence.begin(); itSequence != (*itPrim)->Sequence.end(); ++itSequence)
				lresult.push_back(itSequence->second);
			result->push_back(lresult);
		}
	}

	return result;
}
开发者ID:kkremitzki,项目名称:plantgl,代码行数:26,代码来源:curvemanipulation.cpp

示例2: Load

void Load(Graph& mGraph, vector<Graph::Primitive*>& mPrimitives)
{
    // std::string path = Environment::GetPathR("tri.txt");
    //std::ifstream inFile(path.c_str());
    ifstream inFile("./PlanarGraph.txt");

	//ofstream verify;
  //verify.open("verify.txt",ios::out|ios::app);

    int numVertices;
    inFile >> numVertices;
    //verify<< numVertices<<"\n";
    int i;

    for (i = 0; i < numVertices; ++i)
    {
        double x, y;
        inFile >> x;
        inFile >> y;
      // verify<< x <<"\t"<< y <<"\n";
        //y = GetHeight() - 1 - y;
        mGraph.InsertVertex(Vec2(x, y), i);
    }

    int numEdges;
    inFile >> numEdges;
     //verify<< numEdges<<"\n";
    for (i = 0; i < numEdges; ++i)
    {
        int v0, v1;
        inFile >> v0;
        inFile >> v1;
       // verify<< v0 <<"\t"<< v1 <<"\n";
        mGraph.InsertEdge(v0, v1);
    }

#ifdef EXTRACT_PRIMITIVES
    mGraph.ExtractPrimitives(mPrimitives);
#endif

}
开发者ID:mosquitoboat,项目名称:forceTile,代码行数:41,代码来源:mcb.cpp


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