本文整理汇总了C++中HalfEdge::getSourceNode方法的典型用法代码示例。如果您正苦于以下问题:C++ HalfEdge::getSourceNode方法的具体用法?C++ HalfEdge::getSourceNode怎么用?C++ HalfEdge::getSourceNode使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HalfEdge
的用法示例。
在下文中一共展示了HalfEdge::getSourceNode方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: computeNormals
void TriMesh::computeNormals() {
// skip
// Calculate triangle normals
for(int i = 0; i < m_triangles.size(); i++){
glm::vec3 v1; glm::vec3 v2; glm::vec3 v3;
HalfEdge* tempLeader = m_triangles[i]->getLeadingHalfEdge();
v1 = tempLeader->getSourceNode()->m_pos_;
tempLeader = tempLeader->getNext();
v2 = tempLeader->getSourceNode()->m_pos_;
tempLeader = tempLeader->getNext();
v3 = tempLeader->getSourceNode()->m_pos_;
m_triangles[i]->m_N_ = calculateNormal(v1,v2,v3);
}
// Calculate vertex normals by averaging triange normals
for(int i = 0; i < m_nodes.size(); i++){
Node n = m_nodes[i];
HalfEdge* startEdge = n.getLeadingHalfEdge();
Triangle* startTriangle = startEdge->getTriangle();
glm::vec3 accNormal = startTriangle->m_N_;
int triangleCount = 1;
for(HalfEdge* tempEdge = startEdge->getVtxRingNext(); tempEdge != startEdge; tempEdge = tempEdge->getVtxRingNext()){
if (tempEdge == NULL)
break;
accNormal += tempEdge->getTriangle()->m_N_;
triangleCount++;
}
glm::vec3 count = glm::vec3(triangleCount);
m_nodes[i].m_N_ = accNormal/count;
}
// unskip
}
示例2: getNode
/** Return node no ix from triangle.
* \param ix is either 0, 1 or 2.
*/
Node* getNode(size_t ix) {
HalfEdge *he = m_he_;
for(size_t i=0; i<ix; i++) {
he = he->getNext();
}
return he->getSourceNode();
}