17 static const char sample[] =
"sample.stl";
33 void convert_file(
const char* source_file,
const char* dest_file,
const char* options =
"" );
73 rval =
moab.write_file( output_file,
"STL", options );
CHECK_ERR( rval );
169 Range verts, tris, other;
172 rval =
moab.get_entities_by_handle( 0, other );
CHECK_ERR( rval );
180 const double expt_coords[4][3] = { { 0, 0, 0 }, { 1, 0, 0 }, { 0, 1, 0 }, { 0, 0, 1 } };
188 for(
int j = 0; j < 4; ++j )
191 for(
int d = 0; d < 3; ++d )
193 double dl = expt_coords[j][d] - coords[d];
200 vert_handles[j] = *i;
208 const int expt_conn[4][3] = { { 0, 1, 3 }, { 0, 2, 1 }, { 0, 3, 2 }, { 1, 2, 3 } };
214 rval =
moab.get_connectivity( *i, conn, len );
CHECK_ERR( rval );
217 int conn_idx[3] = {
static_cast< int >( std::find( vert_handles, vert_handles + 4, conn[0] ) - vert_handles ),
218 static_cast< int >( std::find( vert_handles, vert_handles + 4, conn[1] ) - vert_handles ),
219 static_cast< int >( std::find( vert_handles, vert_handles + 4, conn[2] ) - vert_handles ) };
220 CHECK( conn_idx[0] != 4 );
221 CHECK( conn_idx[1] != 4 );
222 CHECK( conn_idx[2] != 4 );
225 for(
int j = 0; j < 4; ++j )
227 int k = std::find( expt_conn[j], expt_conn[j] + 3, conn_idx[0] ) - expt_conn[j];
228 if( k == 3 )
continue;
230 if( expt_conn[j][( k + 1 ) % 3] == conn_idx[1] && expt_conn[j][( k + 2 ) % 3] == conn_idx[2] )