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


C++ Facet::getVertex方法代码示例

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


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

示例1: drawNeighbours

void BCIViz::drawNeighbours() const
{
	if(!checkHull()) return;
	
	Facet f = m_hull->getFacet(m_hitTriangle);
	const Vertex p0 = f.getVertex(0);
	const Vertex p1 = f.getVertex(1);
	const Vertex p2 = f.getVertex(2);
	
	ShapeDrawer drawer;
	drawer.drawCircleAround(p0);
	drawer.drawCircleAround(p1);
	drawer.drawCircleAround(p2);
	drawer.drawCircleAround(m_hitP);
}
开发者ID:ahmidou,项目名称:aphid,代码行数:15,代码来源:bciosVizNode.cpp

示例2: findNeighbours

void BCIViz::findNeighbours()
{
	if(!checkHull()) return;
	const int numTri = m_hull->getNumFace();
	
	Vector3F d;
	d.x = fDriverPos.x;
	d.y = fDriverPos.y;
	d.z = fDriverPos.z;
	
	d.normalize();
	
	m_hitTriangle = 0;
	for(int i = 0; i < numTri; i++)
	{
		Facet f = m_hull->getFacet(i);
		Vertex p0 = f.getVertex(0);
		
		const Vector3F nor = f.getNormal();
		
		float ddotn = d.dot(nor);
		
		if(ddotn < 10e-5 && ddotn > -10e-5) continue;
		
		float t = p0.dot(nor) / ddotn; 
		if(t < 0.f) continue;
		
		Vertex p1 = f.getVertex(1);
		Vertex p2 = f.getVertex(2);
		
		m_hitTriangle = i;
		m_hitP = d * t; 

		Vector3F e01 = p1 - p0;
		Vector3F e02 = p2 - p0;
		Vector3F tmp = e01.cross(e02);
		if(tmp.dot(nor) < 0.f) {
			Vertex sw = p1;
			p1 = p2;
			p2 = sw;
		}
		
		e01 = p1 - p0;
		Vector3F x0 = m_hitP - p0;
		
		Vector3F e12 = p2 - p1;
		Vector3F x1 = m_hitP - p1;
		
		Vector3F e20 = p0 - p2;
		Vector3F x2 = m_hitP - p2;
		
		neighbourId[0] = p0.getIndex();
		neighbourId[1] = p1.getIndex();
		neighbourId[2] = p2.getIndex();
		
		if(e01.cross(x0).dot(nor) < 0.f) continue;
		if(e12.cross(x1).dot(nor) < 0.f) continue;
		if(e20.cross(x2).dot(nor) < 0.f) continue;
		
		return;
	}
}
开发者ID:ahmidou,项目名称:aphid,代码行数:62,代码来源:bciosVizNode.cpp


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