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


C++ Solid::idFace方法代码示例

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


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

示例1: main

void main(int argc, char *argv[])
{
	// Read in the obj file
	Solid mesh;
	OBJFileReader of;
	std::ifstream in(argv[1]);
	string filename = argv[1];
	string::size_type npos = filename.find(".obj");
	string s = ".m";
	filename.replace(npos, 4,s);
	of.readToSolid(&mesh, in);

	/******************* Put you subdivision processing here *********************/


	//1. highlights all edges  zz begin 2013-02-21 16:11:20

	SolidEdgeIterator eiter(&mesh);
	for(; !eiter.end(); ++eiter)
	{
		Edge *e = *eiter;
		e->string ()=std::string("sharp");
	}
	//end zz 2013Äê2ÔÂ21ÈÕ16:18:10

	//2. establish the adjacency list [2/21/2013 Zhe]
	list<int> Graphface[Num];
	SolidFaceIterator fiter(&mesh);
	for(; !fiter.end(); ++fiter)
	{
		Face *f = *fiter;
		FaceHalfedgeIterator hfiter(f);
		HalfEdge *hf = NULL;
		for (;!hfiter.end();++hfiter)
		{		
			hf = *hfiter;
			hf = hf->he_sym();
			Graphface[f->id()].push_back(hf->face()->id());
		}
	}
	//  [2/21/2013 Zhe]

	/************************************************************************/
	/* // 3.MST Algorithm [19:00/2/21/2013 Zhe]                                                                     */
	/************************************************************************/
	list<int> Mstqueue;
	queue<int> nLayer;
	list<int>::iterator mstiterator,Mstqueueiterator,Layeriterator;
	fiter.reset();
	int a[Num] = {0};

	Face *MSTface = *fiter;
	Mstqueue.push_back(MSTface->id());
	nLayer.push(MSTface->id()); //initialization
	a[MSTface->id()] = TRUE;
	while (!nLayer.empty())
	{
		int Faceid = nLayer.front();	
		nLayer.pop();
		//MstGraphface[Faceid].push_back(Faceid);
		for (mstiterator = Graphface[Faceid].begin();mstiterator != Graphface[Faceid].end();++mstiterator)
		{
			//Layeriterator = find (Mstqueue.begin(), Mstqueue.end(), *mstiterator);
			if (a[*mstiterator] == 0) 
			{
				Mstqueue.push_back(*mstiterator);
				nLayer.push(*mstiterator);
				a[*mstiterator] = TRUE;
				int nFaceid_father = Faceid;
				int nFaceId_son = *mstiterator;

				MeshLib::Face *f = mesh.idFace (nFaceid_father);
				MeshLib::FaceHalfedgeIterator fheiter(f);

				MeshLib::Edge * inter_edge;
				for (; !fheiter.end (); ++fheiter)
				{
					MeshLib::HalfEdge *he = *fheiter;
					he = he->he_sym ();
					if (he->face ()->id ()== nFaceId_son)
					{
						inter_edge=he->edge ();
						inter_edge->string () = std::string("");
						break;
					}
				}
			}
		}
	}



	// 3. cut the graph [23:19/2/21/2013 Zhe]
	SolidVertexIterator iter(&mesh);
	std::map<int, int> vidToObjID;

	do 
	{
		for(; !iter.end(); ++iter)
		{
//.........这里部分代码省略.........
开发者ID:paperwhite,项目名称:Subdivision,代码行数:101,代码来源:Subdivision.cpp


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