本文整理汇总了C++中HalfEdge::position方法的典型用法代码示例。如果您正苦于以下问题:C++ HalfEdge::position方法的具体用法?C++ HalfEdge::position怎么用?C++ HalfEdge::position使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HalfEdge
的用法示例。
在下文中一共展示了HalfEdge::position方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GenerateHalfEdgeDataStructure
//.........这里部分代码省略.........
//PrintHalfEdges();
// step 4: for every vertex, find a half-edge emanating out of it
std::cout << "Step 4: For every vertex, caching a half-edge emanating out of it..." << std::endl;
std::cout << " For every face, caching a half-edge on it..." << std::endl;
for (unsigned int i=0; i< objMesh->getNumVertices(); i++)
edgesAtVertices_.push_back(-1); // value of -1 corresponds to no edge (i.e. isolated vertex)
for (unsigned int i=0; i < halfEdges_.size(); i++)
{
//cout << i << " " << halfEdges_[i].startVertex() << " " << halfEdges_[i].endVertex() << endl;
edgesAtVertices_[halfEdges_[i].endVertex()] = i;
}
// if vertex is on the boundary, rotate the edge until it is an incoming boundary edge
// rotate edge until it is either on the boundary, or we come around to the same edge
int numIsolatedVertices = 0;
for (unsigned int i=0; i < objMesh->getNumVertices(); i++)
{
if (isIsolatedVertex(i))
{
numIsolatedVertices++;
continue;
}
HalfEdge * loop = &edgeAtVertex(i);
HalfEdge * start = loop;
do
{
if (loop->isBoundary())
{
// set the edge to the current edge
edgesAtVertices_[i] = loop->position();
break;
}
loop = &edgePrevious(edgeOpposite(*loop));
}
while (*loop != *start);
// if we came around, no need to change edgeAtVertices[i]
}
if (numIsolatedVertices > 0)
printf("Warning: mesh has %d isolated vertices.\n", numIsolatedVertices);
// build the cache for faces, first reset to -1
for (unsigned int i=0; i < objMesh->getNumGroups(); i++)
{
const ObjMesh::Group * currentGroup = objMesh->getGroupHandle(i);
std::vector<int> dataForThisGroup;
dataForThisGroup.clear();
for (unsigned int j=0; j < currentGroup->getNumFaces(); j++)
{
dataForThisGroup.push_back(-1);
}
edgesAtFaces_.push_back(dataForThisGroup);
}
for (unsigned int i=0; i < halfEdges_.size(); i++)
edgesAtFaces_[halfEdges_[i].groupID()][halfEdges_[i].face()] = i;
// sanity check: none of the face entries should be -1
for (unsigned int i=0; i < objMesh->getNumGroups(); i++)
{
const ObjMesh::Group * currentGroup = objMesh->getGroupHandle(i);
for (unsigned int j=0; j < currentGroup->getNumFaces(); j++)
if (edgesAtFaces_[i][j] == -1)