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


C++ TriMesh::cfv_iter方法代码示例

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


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

示例1: faceClosestToPoint

OpenMesh::FaceHandle faceClosestToPoint(TriMesh& mesh, OpenMesh::Vec3f& P)
{
// return a handle to the face that is closes to a give point.
// distance is measured as sum of Euclidean distances from the 3 vertices to the point.
	vector<MyREAL> dist(mesh.n_vertices());
	unsigned int i = 0;

	TriMesh::VertexIter v_it, v_end(mesh.vertices_end());
	for (v_it = mesh.vertices_begin(); v_it!=v_end; ++v_it)
	{
		dist[v_it->idx()]=(P-mesh.point(v_it)).length();
	}

	TriMesh::FaceIter f_it, f_end(mesh.faces_end());
	TriMesh::ConstFaceVertexIter cfvIt;
	double d, mind=10000000000;
	OpenMesh::FaceHandle mindHandle;
	for (f_it = mesh.faces_begin(); f_it!=f_end; ++f_it)
	{
		cfvIt = mesh.cfv_iter(f_it);
		d = dist[ cfvIt.handle().idx()];
		d += dist[ (++cfvIt).handle().idx()];
		d += dist[ (++cfvIt).handle().idx()];
		if (d<mind)
		{
			mind = d;
			mindHandle = f_it.handle();
		}
	} //for (f_it = mesh.faces_begin(); f_it!=f_end; ++f_it)
	return mindHandle ;
} // OpenMesh::FaceHandle faceClosestToPoint(TriMesh& mesh, OpenMesh::Vec3f& P)
开发者ID:alhunor,项目名称:projects,代码行数:31,代码来源:main.cpp

示例2: analyzeTriangle

void analyzeTriangle(OpenMesh::FaceHandle & _fh, TriMesh& mesh)
{
	OpenMesh::Vec3f pointA , pointB , pointC;
	TriMesh::ConstFaceVertexIter cfvIt;
	cfvIt = mesh.cfv_iter(_fh);
	pointA = mesh.point(cfvIt.handle());
	pointB = mesh.point((++cfvIt).handle());
	pointC = mesh.point((++cfvIt).handle());
//	cout<<perimeter(pointA, pointB, pointC) << "   "<< area(pointA, pointB, pointC)<<endl;
	cout<<volume(pointA, pointB, pointC)<<endl; // volume of the tetrahedron with vertices A, B, C and the origin (0,0,0)
	
	//cout<<pointA<<endl;
}
开发者ID:alhunor,项目名称:projects,代码行数:13,代码来源:main.cpp

示例3: meshVolume

double meshVolume(TriMesh& mesh)
{
	mesh.request_face_normals();
	mesh.update_normals();
	double vol = 0;
	double surf = 0;

	//iterate through all faces;
	TriMesh::FaceIter f_it, f_end(mesh.faces_end());
	OpenMesh::Vec3f pointA , pointB , pointC;
	TriMesh::ConstFaceVertexIter cfvIt;

	for (f_it = mesh.faces_begin(); f_it!=f_end; ++f_it)
	{
		cfvIt = mesh.cfv_iter(f_it);
		pointA = mesh.point(cfvIt.handle());
		pointB = mesh.point((++cfvIt).handle());
		pointC = mesh.point((++cfvIt).handle());
		surf += area(pointA, pointB, pointC);
		vol += volume(pointA, pointB, pointC);
	}
	return vol;

} // double meshVolume(TriMesh& mesh)
开发者ID:alhunor,项目名称:projects,代码行数:24,代码来源:main.cpp


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