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


C++ Tab::Insert方法代码示例

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


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

示例1: OrderLists

void TVConnectionInfo::OrderLists()
{

	int hiddenVertID = -1;
	for (int i = 0; i < mVertex.Count(); i++)
	{




		if (mVertex[i]->mConnectedFaces.Count() > 0)
		{
		//	DumpVert(i);

			//order our faces
			Tab<int> faceStack;
			Tab<int> finalFaceStack;
			Tab<int> remainingFaces = mVertex[i]->mConnectedFaces;
			faceStack.Append(1,&remainingFaces[0]);
			remainingFaces.Delete(0,1);
			int vert = i;
			
			//gather all the faces that are together and ordered them
			while (remainingFaces.Count() > 0)
			{
				int currentFace = faceStack[0];
				int prevVert = -1;
				int nextVert = -1;
				int deg = mMd->GetFaceDegree(currentFace);
				for (int j = 0; j < deg; j++)
				{
					int a = mMd->GetFaceTVVert(currentFace,j);
					if (a == vert)
					{
						nextVert = mMd->GetFaceTVVert(currentFace,(j+1)%deg);
						prevVert = mMd->GetFaceTVVert(currentFace,(j+deg-1)%deg);
						j = deg;
					}
				}

				int  hit = FALSE;
				for (int j = 0; j < remainingFaces.Count(); j++)
				{
					int faceIndex = remainingFaces[j];
					//see if we have any matching faces
					int ithEdge = mMd->FindUVEdge(faceIndex,vert,nextVert);
					if (ithEdge != -1) //we have a match
					{
						faceStack.Append(1,&faceIndex,8);
						remainingFaces.Delete(j,1);					 
						j = -1;
						hit = TRUE;

						//find the new nextvert
						int deg = mMd->GetFaceDegree(faceIndex);						
						for (int k = 0; k < deg; k++)
						{
							int a = mMd->GetFaceTVVert(faceIndex,k);
							if (a == vert)
							{
								nextVert = mMd->GetFaceTVVert(faceIndex,(k+1)%deg);
								k = deg;
							}
						}
					}
					else
					{
						ithEdge = mMd->FindUVEdge(faceIndex,vert,prevVert);
						if (ithEdge != -1) //we have a match
						{
							faceStack.Insert(0,1,&faceIndex);
							remainingFaces.Delete(j,1);
							j = -1;
							hit = TRUE;

							//find the new prevvert
							int deg = mMd->GetFaceDegree(faceIndex);
							for (int k = 0; k < deg; k++)
							{
								int a = mMd->GetFaceTVVert(faceIndex,k);
								if (a == vert)
								{									
									prevVert = mMd->GetFaceTVVert(faceIndex,(k+deg-1)%deg);
									k = deg;
								}
							}
						}						
					}
				}

				//see if we hit an open edge if so add all the faces we have and add a -1 to mark the gap
				int remainingFacesCount = remainingFaces.Count();
				if (hit == FALSE || (remainingFacesCount == 0))
				{
					for (int j = 0; j < faceStack.Count(); j++)
						finalFaceStack.Append(1,&faceStack[j],8);
					int neg = -1;
					if (remainingFaces.Count() != 0)
						finalFaceStack.Append(1,&neg);

//.........这里部分代码省略.........
开发者ID:artemeliy,项目名称:inf4715,代码行数:101,代码来源:TvConnectionInfo.cpp


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