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


C++ AABB3::AddPoint方法代码示例

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


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

示例1: ClipLineSegment

	// clip trace at the point of contact
void CTriangleMesh::ClipLineSegment( CJL_LineSegment& segment )
{
	Vector3 vStart = segment.vStart;
	Vector3 vEnd;
	if( segment.fFraction == 1.0f )
		vEnd = segment.vGoal;
	else
		vEnd = segment.vEnd;	// the line segment has been already clipped - set the current end point

	static vector<int> s_veciTriList;
	s_veciTriList.resize( 0 );

	AABB3 aabb;
	aabb.Nullify();
	aabb.AddPoint( vStart );
	aabb.AddPoint( vEnd );

	GetIntersectingTriangles( s_veciTriList, aabb );

	size_t i, iNumTris = s_veciTriList.size();

	if( iNumTris == 0 )
		return;	// no intersection

	Vector3 vOrigLineSegment = vEnd - vStart;

	for( i=0; i<iNumTris; i++ )
	{
		IndexedTriangle& tri = GetTriangle( s_veciTriList[i] );
		Triangle triangle( GetVertex( tri.GetIndex(0) ),
			                GetVertex( tri.GetIndex(1) ),
							GetVertex( tri.GetIndex(2) ),
							tri.m_vNormal );

		// check intersection between ray and triangle
		if( triangle.RayIntersect( vStart, vEnd ) )
		{	// found intersection
			// 'vEnd' now represents the intersection point

			// save contact surface
			segment.plane = triangle.GetPlane();

			// record surface material to 'tr'
			segment.iMaterialIndex = tri.m_iMaterialID;
		}
	}

	segment.fFraction *= Vec3Dot( vEnd - vStart, vOrigLineSegment ) / Vec3LengthSq( vOrigLineSegment );
	segment.vEnd = vEnd;
}
开发者ID:HermanHGF,项目名称:amorphous,代码行数:51,代码来源:TriangleMesh.cpp

示例2: UpdateParticles

/**
 * updates position, velocity, and animation time of particles
 *  - rParticleSet.aabb is also updated
 *
 */
inline void CBE_ParticleSet::UpdateParticles( ParticleSetExtraData& rParticleSet, float dt, AABB3& aabb )
{
//	Vector3 vGravityAccel = m_pStage->GetGravityAccel();
//	float fGravityInfluenceFactor = m_fGravityInfluenceFactor;
	Vector3 vGravityAccel = m_pStage->GetGravityAccel() * m_fGravityInfluenceFactor;

//	AABB3 aabb;
	aabb.Nullify();

	int i, num_particles = rParticleSet.iNumParticles;
	for(i=0; i<num_particles; i++)
	{
		// update velocity
//		rParticleSet.pavVelocity[i] += (vGravityAccel * fGravityInfluenceFactor) * dt;
		rParticleSet.pavVelocity[i] += vGravityAccel * dt;

		// update position
		rParticleSet.pavPosition[i] += rParticleSet.pavVelocity[i] * dt;

		// update animation time
		rParticleSet.pafAnimationTime[i] += dt;

		aabb.AddPoint( rParticleSet.pavPosition[i] );
	}

	const float r = m_fParticleRadius;
	aabb.vMin -= Vector3(r,r,r);
	aabb.vMax += Vector3(r,r,r);

	rParticleSet.aabb = aabb;
}
开发者ID:nyankosoft,项目名称:amorphous,代码行数:36,代码来源:BE_ParticleSet.hpp

示例3: UpdateAABB

inline void IndexedPolygon::UpdateAABB()
{
	m_AABB.Nullify();

	const size_t num_vertices = m_index.size();
	for( size_t i=0; i<num_vertices; i++ )
	{
		m_AABB.AddPoint( GetVertex(i).m_vPosition );
	}
}
开发者ID:HermanHGF,项目名称:amorphous,代码行数:10,代码来源:IndexedPolygon.hpp

示例4: GetAABB

inline AABB3 GetAABB( const std::vector<IndexedPolygon>& polygon_buffer )
{
	AABB3 aabb;
	aabb.Nullify();

	size_t i, num_pols = polygon_buffer.size();
	size_t j, num_verts;
	for( i=0; i<num_pols; i++ )
	{
		// polygon_buffer[i].Update();
		// aabb.MergeAABB( polygon_buffer[i].GetAABB() );

		num_verts = polygon_buffer[i].m_index.size();
		for( j=0; j<num_verts; j++ )
		{
			aabb.AddPoint( polygon_buffer[i].GetVertex((int)j).m_vPosition );
		}
	}

	return aabb;
}
开发者ID:HermanHGF,项目名称:amorphous,代码行数:21,代码来源:IndexedPolygon.hpp

示例5: UpdateParticlePositions

/**
 * updates position, velocity, and animation time of particles
 *  - rParticleSet.aabb is also updated
 *
 */
inline void CBE_ParticleSet::UpdateParticlePositions( ParticleSetExtraData& rParticleSet, float dt, AABB3& aabb )
{
//	AABB3 aabb;
	aabb.Nullify();

	int i, num_particles = rParticleSet.iNumParticles;
	for(i=0; i<num_particles; i++)
	{
		// update position
		rParticleSet.pavPosition[i] += rParticleSet.pavVelocity[i] * dt;

		// update animation time
		rParticleSet.pafAnimationTime[i] += dt;

		aabb.AddPoint( rParticleSet.pavPosition[i] );
	}

	const float r = m_fParticleRadius;
	aabb.vMin -= Vector3(r,r,r);
	aabb.vMax += Vector3(r,r,r);

	rParticleSet.aabb = aabb;
}
开发者ID:nyankosoft,项目名称:amorphous,代码行数:28,代码来源:BE_ParticleSet.hpp


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