本文整理汇总了C++中SWIFT_Array::Add_Grow方法的典型用法代码示例。如果您正苦于以下问题:C++ SWIFT_Array::Add_Grow方法的具体用法?C++ SWIFT_Array::Add_Grow怎么用?C++ SWIFT_Array::Add_Grow使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SWIFT_Array
的用法示例。
在下文中一共展示了SWIFT_Array::Add_Grow方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Upper_Leaves_CB
int Upper_Leaves_CB( Togl *togl, int argc, const char *argv[] )
{
int i;
if( uleaves ) {
// Include all leaves above the current level
for( i = 0; i < num_leaves; i++ ) {
if( leaves[i]->Level() < level ) {
which_pieces.Add_Grow( leaves[i], 10 );
}
}
} else {
// Remove all leaves above the current level
SWIFT_Array<SWIFT_BV*> new_which_pieces;
new_which_pieces.Create( which_pieces.Length() );
new_which_pieces.Set_Length( 0 );
for( i = 0; i < which_pieces.Length(); i++ ) {
if( !which_pieces[i]->Is_Leaf() ||
which_pieces[i]->Level() == level
) {
// Keep this piece
new_which_pieces.Add( which_pieces[i] );
}
}
which_pieces.Destroy();
which_pieces = new_which_pieces;
new_which_pieces.Nullify();
}
Togl_PostRedisplay( t );
return TCL_OK;
}
示例2: Edge_Flip
void Edge_Flip( SWIFT_Tri_Mesh* m, SWIFT_Real etol )
{
const SWIFT_Real etol_sq = etol*etol;
int i;
SWIFT_Tri_Face f;
SWIFT_Array<SWIFT_Tri_Edge*> fedges;
// Have all the convex edges marked
Prepare_Mesh_For_Decomposition( m );
// Traverse all the faces, marking edges that are not allowed to be flipped
for( i = 0; i < m->Num_Faces(); i++ ) {
if( m->Faces()[i].Edge1().Unmarked() ) {
// May be able to flip this edge
// Build the proposed edge
f.Edge1().Set_Origin( m->Faces()[i].Edge3().Origin() );
f.Edge2().Set_Origin(
m->Faces()[i].Edge1().Twin()->Prev()->Origin() );
f.Edge1().Compute_Direction_Length();
if( Edge_Flip_Allowed( m->Faces()[i].Edge1P(), f.Edge1P(), etol_sq )
) {
fedges.Add_Grow( m->Faces()[i].Edge1P(), 100 );
// Have to mark other edges in these two faces as well as
// their twins
m->Faces()[i].Edge2().Mark();
m->Faces()[i].Edge2().Twin()->Mark();
m->Faces()[i].Edge3().Mark();
m->Faces()[i].Edge3().Twin()->Mark();
m->Faces()[i].Edge1().Twin()->Next()->Mark();
m->Faces()[i].Edge1().Twin()->Next()->Twin()->Mark();
m->Faces()[i].Edge1().Twin()->Prev()->Mark();
m->Faces()[i].Edge1().Twin()->Prev()->Twin()->Mark();
}
m->Faces()[i].Edge1().Mark();
m->Faces()[i].Edge1().Twin()->Mark();
}
if( m->Faces()[i].Edge2().Unmarked() ) {
// May be able to flip this edge
// Build the proposed edge
f.Edge1().Set_Origin( m->Faces()[i].Edge1().Origin() );
f.Edge2().Set_Origin(
m->Faces()[i].Edge2().Twin()->Prev()->Origin() );
f.Edge1().Compute_Direction_Length();
if( Edge_Flip_Allowed( m->Faces()[i].Edge2P(), f.Edge1P(), etol_sq )
) {
fedges.Add_Grow( m->Faces()[i].Edge2P(), 100 );
m->Faces()[i].Edge1().Mark();
m->Faces()[i].Edge1().Twin()->Mark();
m->Faces()[i].Edge3().Mark();
m->Faces()[i].Edge3().Twin()->Mark();
m->Faces()[i].Edge2().Twin()->Next()->Mark();
m->Faces()[i].Edge2().Twin()->Next()->Twin()->Mark();
m->Faces()[i].Edge2().Twin()->Prev()->Mark();
m->Faces()[i].Edge2().Twin()->Prev()->Twin()->Mark();
}
m->Faces()[i].Edge2().Mark();
m->Faces()[i].Edge2().Twin()->Mark();
}
if( m->Faces()[i].Edge3().Unmarked() ) {
// May be able to flip this edge
// Build the proposed edge
f.Edge1().Set_Origin( m->Faces()[i].Edge2().Origin() );
f.Edge2().Set_Origin(
m->Faces()[i].Edge3().Twin()->Prev()->Origin() );
f.Edge1().Compute_Direction_Length();
if( Edge_Flip_Allowed( m->Faces()[i].Edge3P(), f.Edge1P(), etol_sq )
) {
fedges.Add_Grow( m->Faces()[i].Edge3P(), 100 );
m->Faces()[i].Edge1().Mark();
m->Faces()[i].Edge1().Twin()->Mark();
m->Faces()[i].Edge2().Mark();
m->Faces()[i].Edge2().Twin()->Mark();
m->Faces()[i].Edge3().Twin()->Next()->Mark();
m->Faces()[i].Edge3().Twin()->Next()->Twin()->Mark();
m->Faces()[i].Edge3().Twin()->Prev()->Mark();
m->Faces()[i].Edge3().Twin()->Prev()->Twin()->Mark();
}
m->Faces()[i].Edge3().Mark();
m->Faces()[i].Edge3().Twin()->Mark();
}
}
cerr << "Flipped " << fedges.Length() << " edges" << endl;
// Do the actual swaps
for( i = 0; i < fedges.Length(); i++ ) {
SWIFT_Tri_Edge* t1 = fedges[i]->Prev()->Twin();
SWIFT_Tri_Edge* t2 = fedges[i]->Twin()->Prev()->Twin();
// Set the origins
fedges[i]->Set_Origin( fedges[i]->Twin()->Prev()->Origin() );
fedges[i]->Twin()->Set_Origin( fedges[i]->Prev()->Origin() );
// Set the flipped edge twins
//.........这里部分代码省略.........