本文整理汇总了C++中SmallPtrSet::Clear方法的典型用法代码示例。如果您正苦于以下问题:C++ SmallPtrSet::Clear方法的具体用法?C++ SmallPtrSet::Clear怎么用?C++ SmallPtrSet::Clear使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SmallPtrSet
的用法示例。
在下文中一共展示了SmallPtrSet::Clear方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: normalFlips
// Check Compare before and after normals of affected faces.
// If a normal changes more by more than pi/2 (90 deg), then
// we will disallow this contraction and terminate early.
BOOL Pair::normalFlips(SmallPtrSet& updatedFaces, SmallPtrSet& rvFaces, BOOL& smallNormalChange)
{
Vertex* keepVertex = getContractTarget();
Vertex* removeVertex = NULL;
if (keepVertex == v1)
removeVertex = v2;
else
removeVertex = v1;
// Compute adjusted faces:
rvFaces.Clear();
updatedFaces.Clear();
removeVertex->computeFaceSet(rvFaces); // problem here, rvFaces different
SmallPtrSet_Difference(&rvFaces, &m_Faces, &updatedFaces);
Vertex *v1, *v2, *v3;
U32 SetCtx = 0;
Face* face = (Face*)updatedFaces.Begin(SetCtx);
smallNormalChange = TRUE;
F32 dotThresh = 0.966f; // about 15 degrees
F32 worstDot=1;
BOOL result = FALSE;
IV3D u, v, oldNormal, newNormal;
F32 dot;
while(face && !result)
{
if( !result )
{
v1 = face->a->getCommonVertex(face->b);
v2 = face->b->getCommonVertex(face->c);
v3 = face->c->getCommonVertex(face->a);
// Compute the normal - we could grab this data from the equation of the plane (A, B, C, D),
// but then we'd have to keep A, B, C, D around in the faces:
subtract3D ((IV3D*)&v2->v, (IV3D*)&v1->v, (IV3D*)&u);
if( isZero(&u) )
{
if(cost < NORMAL_FLIP_COST)
cost = NORMAL_FLIP_COST;
result = TRUE;
}
}
if( !result )
{
normalize3D ((IV3D*)&u);
subtract3D ((IV3D*)&v3->v, (IV3D*)&v1->v, (IV3D*)&v);
if( isZero(&v) )
{
if(cost < NORMAL_FLIP_COST)
cost = NORMAL_FLIP_COST;
result = TRUE;
}
}
if( !result )
{
normalize3D ((IV3D*)&v);
crossprod ((IV3D*)&u, (IV3D*)&v, &oldNormal);
if( isZero(&oldNormal) )
{
if(cost < NORMAL_FLIP_COST)
cost = NORMAL_FLIP_COST;
result = TRUE;
}
}
if( !result )
normalize3D (&oldNormal);
// Recompute the normal:
if( !result )
{
// Install the keep vertex into this temp version of the adjusted face:
if (v1 == removeVertex) v1 = keepVertex;
if (v2 == removeVertex) v2 = keepVertex;
if (v3 == removeVertex) v3 = keepVertex;
subtract3D ((IV3D*)&v2->v, (IV3D*)&v1->v, (IV3D*)&u);
if( isZero(&u) )
{
if(cost < NORMAL_FLIP_COST)
cost = NORMAL_FLIP_COST;
result = TRUE;
}
}
if( !result )
{
normalize3D ((IV3D*)&u);
subtract3D ((IV3D*)&v3->v, (IV3D*)&v1->v, (IV3D*)&v);
if( isZero(&v) )
{
//.........这里部分代码省略.........