本文整理汇总了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;
}
示例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;
}
示例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 );
}
}
示例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;
}
示例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;
}