本文整理汇总了C++中SWIFT_Array::Destroy方法的典型用法代码示例。如果您正苦于以下问题:C++ SWIFT_Array::Destroy方法的具体用法?C++ SWIFT_Array::Destroy怎么用?C++ SWIFT_Array::Destroy使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SWIFT_Array
的用法示例。
在下文中一共展示了SWIFT_Array::Destroy方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: Key_K_CB
int Key_K_CB( Togl *togl, int argc, const char *argv[] )
{
if( dh == DRAW_HIERARCHY ) {
if( which_pieces.Length() != 1 ) {
// Go up the hierarchy
int i;
SWIFT_Array<SWIFT_BV*> new_which_pieces( which_pieces.Length() );
SWIFT_BV* parent;
new_which_pieces.Set_Length( 0 );
parent = NULL;
for( i = 0; i < which_pieces.Length(); i++ ) {
if( uleaves && which_pieces[i]->Is_Leaf() &&
which_pieces[i]->Level() < level
) {
new_which_pieces.Add( which_pieces[i] );
} else if( parent != which_pieces[i]->Parent() ) {
parent = which_pieces[i]->Parent();
new_which_pieces.Add( parent );
}
}
level--;
// Include the new leaves at this level if uleaves is false
if( !uleaves ) {
for( i = 0; i < num_leaves; i++ ) {
if( leaves[i]->Level() == level ) {
new_which_pieces.Add_Grow( leaves[i], 10 );
}
}
}
which_pieces.Destroy();
which_pieces = new_which_pieces;
new_which_pieces.Nullify();
}
} else {
// Show next convex piece and set text field
char temp[80];
if( which_cps.Length() == 0 ) {
which_cps.Set_Length( 1 );
which_cps[0] = 0;
} else {
which_cps[0] = (which_cps[0] == which_cps.Max_Length()-1 ?
0 : which_cps[0]+1);
which_cps.Set_Length( 1 );
}
sprintf( temp, "set which_cps %d", which_cps[0] );
Tcl_Eval( Togl_Interp( togl ), temp );
}
Togl_PostRedisplay( togl );
return TCL_OK;
}
示例3: Key_J_CB
int Key_J_CB( Togl *togl, int argc, const char *argv[] )
{
if( dh == DRAW_HIERARCHY ) {
int i, j;
bool advanced = false;
SWIFT_Array<SWIFT_BV*> new_which_pieces( 100 );
new_which_pieces.Set_Length( 0 );
for( i = 0; i < which_pieces.Length(); i++ ) {
if( uleaves && which_pieces[i]->Is_Leaf() ) {
// Keep this leaf
new_which_pieces.Add_Grow( which_pieces[i], 10 );
} else {
for( j = 0; j < which_pieces[i]->Num_Children(); j++ ) {
new_which_pieces.Add_Grow(
which_pieces[i]->Children()[j], 10 );
advanced = true;
}
}
}
if( advanced ) {
level++;
which_pieces.Destroy();
which_pieces = new_which_pieces;
new_which_pieces.Nullify();
}
} else {
// Show previous convex piece and set text field
char temp[80];
if( which_cps.Length() == 0 ) {
which_cps.Set_Length( 1 );
which_cps[0] = 0;
} else {
which_cps[0] = (which_cps[0] == 0 ?
which_cps.Max_Length()-1 : which_cps[0]-1);
which_cps.Set_Length( 1 );
}
sprintf( temp, "set which_cps %d", which_cps[0] );
Tcl_Eval( Togl_Interp( togl ), temp );
}
Togl_PostRedisplay( togl );
return TCL_OK;
}
示例4: Compute_Leaves
void Compute_Leaves( SWIFT_BV* piece )
{
int i;
if( piece == mesh->Root() ) {
leaves.Destroy();
leaves.Create( num_leaves );
leaves.Set_Length( 0 );
}
if( piece->Is_Leaf() ) {
leaves.Add( piece );
} else {
for( i = 0; i < piece->Num_Children(); i++ ) {
Compute_Leaves( piece->Children()[i] );
}
}
}