本文整理汇总了C++中TriMesh::calcVertexNormals方法的典型用法代码示例。如果您正苦于以下问题:C++ TriMesh::calcVertexNormals方法的具体用法?C++ TriMesh::calcVertexNormals怎么用?C++ TriMesh::calcVertexNormals使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TriMesh
的用法示例。
在下文中一共展示了TriMesh::calcVertexNormals方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: updateAll
//.........这里部分代码省略.........
{
newMarker = false;
markers[i].addPoint( opoint );
}
}
if( newMarker )
{
Marker m;
m.addPoint( opoint );
markers.push_back( m );
}
}
}
}
// see if the the scanpoint is actually on the edge of the scan
bool edge =
point_num == 0
|| point_num == (line.ranges.size()-1)
|| line_num == 0
|| line_num == (scan.lines.size()-1);
point_attrs.push_back( edge << TriMesh::SCAN_EDGE );
idx_line[point_num] = points.size() - 1;
} else {
idx_line[point_num] = -1;
}
if( line_num > 0 && point_num > 0) {
// prev_line is valid now, we can start looking for polygons
int poly[4] = { prev_idx_line[point_num-1],
prev_idx_line[point_num],
idx_line[point_num],
idx_line[point_num-1] };
int first_poly = -1;
for(int n=0;n<4;n++) {
int idx[] = {0+(n<=0),1+(n<=1),2+(n<=2)};
// check polygon for existance and then see if all
// three edges are within the threshold limit
if( (poly[idx[0]] > 0) && (poly[idx[1]] > 0) && (poly[idx[2]] > 0) &&
(first_poly==-1 || (first_poly+n)%2==0 ) ) {
float dist_a = (points[poly[idx[0]]] - points[poly[idx[1]]]).norm();
float dist_b = (points[poly[idx[0]]] - points[poly[idx[2]]]).norm();
float dist_c = (points[poly[idx[1]]] - points[poly[idx[2]]]).norm();
if( dist_a < maxEdgeLength && dist_b < maxEdgeLength && dist_c < maxEdgeLength ) {
// found a polygon save idx to prevent the
// overlapping part to be selected, but still look
// for a second one
first_poly = n;
// observe the triangle order for faces on the
// other half of the sphere
//
// TODO, this is not the right check for a reverse
// triangle, because of the offset
if( fabs(psi) > (M_PI/2) ) {
triangle_t tri( poly[idx[0]], poly[idx[2]], poly[idx[1]] );
faces.push_back( tri );
} else {
triangle_t tri( poly[idx[0]], poly[idx[1]], poly[idx[2]] );
faces.push_back( tri );
}
}
}
}
}
psi += scan.delta_psi;
}
// swap line and previous line
int *tmp = idx_line;
idx_line = prev_idx_line;
prev_idx_line = tmp;
}
for(size_t i=0;i<markers.size();i++)
{
std::cout << "marker " << i << " center: " << markers[i].center.transpose() << " pixel: " << markers[i].points.size() << std::endl;
}
// calculate vertex normals
meshPtr->calcVertexNormals();
// remove colors if empty
assert( colors.empty() || colors.size() == points.size() );
if( colors.empty() )
meshPtr->removeData( TriMesh::VERTEX_COLOR );
// mark item as modified
env->itemModified( meshPtr );
return true;
}