本文整理汇总了C++中SWIFT_Array::Add方法的典型用法代码示例。如果您正苦于以下问题:C++ SWIFT_Array::Add方法的具体用法?C++ SWIFT_Array::Add怎么用?C++ SWIFT_Array::Add使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SWIFT_Array
的用法示例。
在下文中一共展示了SWIFT_Array::Add方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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] );
}
}
}
示例2: Convex_Pieces_CB
int Convex_Pieces_CB( Togl *togl, int argc, const char *argv[] )
{
if( argv[2][0] == 'A' || argv[2][0] == 'a' ) {
// Want to draw all pieces
int i;
which_cps.Set_Length( which_cps.Max_Length() );
for( i = 0; i < which_cps.Length(); i++ ) {
which_cps[i] = i;
}
} else {
// Parse the string to determine which ones to draw
long upper, lower;
const char* str = argv[2];
char* endp;
int i;
SWIFT_Array<int> which_cps_back = which_cps;
which_cps.Set_Length( 0 );
while( *str != '\0' && which_cps.Length() != which_cps.Max_Length() ) {
if( isdigit( *str ) ) {
// Read the next segment
lower = strtol( str, &endp, 10 );
str = endp;
if( lower < 0 ) {
lower = 0;
}
if( lower >= which_cps.Max_Length() ) {
lower = which_cps.Max_Length()-1;
}
upper = lower;
if( *str == '-' ) {
str++;
if( isdigit( *str ) ) {
upper = strtol( str, &endp, 10 );
str = endp;
if( upper < 0 ) {
upper = 0;
}
if( upper >= which_cps.Max_Length() ) {
upper = which_cps.Max_Length()-1;
}
if( upper < lower ) {
int j = lower;
lower = upper;
upper = j;
}
} else {
cerr << "Error: Expecting number after '-'" << endl;
which_cps = which_cps_back;
break;
}
}
// Save the segment
for( i = lower; i <= upper &&
which_cps.Length() != which_cps.Max_Length(); i++
) {
which_cps.Add( i );
}
// Done this segment
if( *str == ',' ) {
str++;
} else {
// Assume that we found the end of the list
break;
}
} else {
break;
}
}
}
Togl_PostRedisplay( t );
return TCL_OK;
}
示例3: Decompose_Cresting_BFS
int Decompose_Cresting_BFS( SWIFT_Tri_Mesh* m, SWIFT_Array<int>& piece_ids,
SWIFT_Array< SWIFT_Array<int> >& mfs,
SWIFT_Array< SWIFT_Array<SWIFT_Tri_Face> >& vfs )
{
// Start performing BFS on the dual graph maintaining a convex hull along
// the way.
cerr << endl << "Starting cresting BFS decomposition" << endl;
const unsigned int max_faces_in_a_chull = (m->Num_Vertices() - 2) << 1;
int i, j, k, l;
int created_faces = 0;
int front, id;
bool add_children;
SWIFT_Tri_Edge* e;
SWIFT_Tri_Vertex* v;
SWIFT_Array<SWIFT_Tri_Face*> qfs; // The queue
SWIFT_Array<SWIFT_Tri_Face*> qfs_parents;
SWIFT_Array<int> qmap;
SWIFT_Array<int> qmap_idx;
SWIFT_Array<SWIFT_Tri_Face*> mark_failed;
SWIFT_Array<SWIFT_Tri_Face> chull;
SWIFT_Array<SWIFT_Tri_Face*> cfs;
SWIFT_Array<bool> fallowed;
SWIFT_Array<bool> cvs;
SWIFT_Array<int> cvs_idx;
SWIFT_Array<int> addedfs;
SWIFT_Array<int> temp_mfs_1d;
SWIFT_Array< SWIFT_Array<int> > temp_mfs_2d;
// The priority queue
SWIFT_Array<int> lengths( m->Num_Faces() );
SWIFT_Array<int> bmap( m->Num_Faces() );
SWIFT_Array<int> fmap( m->Num_Faces() );
qfs.Create( m->Num_Faces() );
qfs_parents.Create( m->Num_Faces() );
qmap.Create( m->Num_Faces() );
qmap_idx.Create( m->Num_Faces() );
mark_failed.Create( m->Num_Faces() );
chull.Create( max_faces_in_a_chull );
cfs.Create( max_faces_in_a_chull );
fallowed.Create( m->Num_Faces() );
cvs.Create( m->Num_Vertices() );
cvs_idx.Create( m->Num_Vertices() );
addedfs.Create( m->Num_Faces() );
temp_mfs_1d.Create( m->Num_Faces() );
temp_mfs_2d.Create( m->Num_Faces() );
vfs.Create( m->Num_Faces() );
piece_ids.Create( m->Num_Faces() );
Prepare_Mesh_For_Decomposition( m );
cvs_idx.Set_Length( 0 );
qmap_idx.Set_Length( 0 );
for( i = 0; i < m->Num_Vertices(); i++ ) {
cvs[i] = false;
}
for( i = 0; i < m->Num_Faces(); i++ ) {
fallowed[i] = true;
piece_ids[i] = -1;
qmap[i] = -1;
bmap[i] = fmap[i] = i;
if( m->Faces()[i].Edge1().Unmarked() ||
m->Faces()[i].Edge2().Unmarked() ||
m->Faces()[i].Edge3().Unmarked()
) {
lengths[i] = 0;
qmap_idx.Add( i );
} else {
lengths[i] = -1;
}
}
id = 0;
// Calculate distances for each face and create priority queue
if( !qmap_idx.Empty() ) {
// This is a convex object
for( i = 0; i < qmap_idx.Max_Length(); i++ ) {
if( m->Faces()[qmap_idx[i]].Edge1().Twin() != NULL ) {
k = m->Face_Id(
m->Faces()[qmap_idx[i]].Edge1().Twin()->Adj_Face() );
if( lengths[k] == -1 ) {
lengths[k] = lengths[qmap_idx[i]]+1;
qmap_idx.Add( k );
}
}
if( m->Faces()[qmap_idx[i]].Edge2().Twin() != NULL ) {
k = m->Face_Id(
m->Faces()[qmap_idx[i]].Edge2().Twin()->Adj_Face() );
if( lengths[k] == -1 ) {
lengths[k] = lengths[qmap_idx[i]]+1;
qmap_idx.Add( k );
}
}
if( m->Faces()[qmap_idx[i]].Edge3().Twin() != NULL ) {
k = m->Face_Id(
m->Faces()[qmap_idx[i]].Edge3().Twin()->Adj_Face() );
//.........这里部分代码省略.........