本文整理汇总了C++中Simplex::GetFaces方法的典型用法代码示例。如果您正苦于以下问题:C++ Simplex::GetFaces方法的具体用法?C++ Simplex::GetFaces怎么用?C++ Simplex::GetFaces使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Simplex
的用法示例。
在下文中一共展示了Simplex::GetFaces方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: UpdateDiagnostics
void CollisionSolver::UpdateDiagnostics(const Simplex& simplex,
const D3DXVECTOR3& furthestPoint)
{
if(m_engine->diagnostic()->AllowDiagnostics(Diagnostic::COLLISION))
{
const float radius = 0.1f;
const float normalLength = 1.5f;
D3DXVECTOR3 origin(0.0, 0.0, 0.0);
m_engine->diagnostic()->UpdateSphere(Diagnostic::COLLISION,
"OriginPoint", Diagnostic::WHITE, origin, radius);
m_engine->diagnostic()->UpdateSphere(Diagnostic::COLLISION,
"FurthestPoint", Diagnostic::MAGENTA, furthestPoint, radius);
const auto& borders = simplex.GetBorderEdges();
for(unsigned int i = 0; i < borders.size(); ++i)
{
m_engine->diagnostic()->UpdateLine(Diagnostic::COLLISION,
"BorderEdge" + StringCast(i), Diagnostic::RED,
simplex.GetPoint(borders[i].indices[0]),
simplex.GetPoint(borders[i].indices[1]));
}
const auto& faces = simplex.GetFaces();
for(unsigned int i = 0; i < faces.size(); ++i)
{
if(faces[i].alive)
{
std::string id = StringCast(i);
const Face& face = faces[i];
const D3DXVECTOR3 center = simplex.GetFaceCenter(i);
const D3DXVECTOR3& normal = face.normal * normalLength;
const D3DXVECTOR3& pointA = simplex.GetPoint(face.indices[0]);
const D3DXVECTOR3& pointB = simplex.GetPoint(face.indices[1]);
const D3DXVECTOR3& pointC = simplex.GetPoint(face.indices[2]);
m_engine->diagnostic()->UpdateSphere(Diagnostic::COLLISION,
"sCenter" + id, Diagnostic::BLUE, center, radius);
m_engine->diagnostic()->UpdateLine(Diagnostic::COLLISION,
"sNormal" + id, Diagnostic::BLUE, center, center + normal);
m_engine->diagnostic()->UpdateLine(Diagnostic::COLLISION,
"sLine1" + id, Diagnostic::YELLOW, pointA, pointB);
m_engine->diagnostic()->UpdateLine(Diagnostic::COLLISION,
"sLine2" + id, Diagnostic::YELLOW, pointA, pointC);
m_engine->diagnostic()->UpdateLine(Diagnostic::COLLISION,
"sLine3" + id, Diagnostic::YELLOW, pointC, pointB);
}
}
}
}