📄 itkquadedgemesheuleroperatorjoinvertextest.cxx
字号:
// 0 ---------- 1 ----------------------- 3 --------- 4
//
PopulateMesh<MeshType>( mesh );
std::cout << " ";
std::cout << "Join v of border edge with only Left set (possible).";
joinVertex->SetInput( mesh );
if( !joinVertex->Evaluate( mesh->FindEdge( 2, 3 ) ) )
{
std::cout << "FAILED." << std::endl;
return EXIT_FAILURE;
}
mesh->DeletePoint( joinVertex->GetOldPointID( ) );
if( ! AssertTopologicalInvariants< MeshType >
( mesh, 24, 54, 31, 1, 0 ) )
{
std::cout << "FAILED (for [ 2, 3 ] )." << std::endl;
return EXIT_FAILURE;
}
if ( mesh->GetPoint( 3 ).GetValence( ) != 5 )
{
std::cout << "FAILED (for [ 2, 3 ], wrong valence of "
<< mesh->GetPoint( 3 ).GetValence( )
<< " for vertex 3 )." << std::endl;
return EXIT_FAILURE;
}
std::cout << "OK" << std::endl;
// Now try with a wire edge (a pathological edge which has no face
// neither on it's left nor on it's right).
// Create this situation by manually deleting two faces sharing the
// same edge which will thus become a wire edge.
//
// 20 --------- 21 --------- 22 --------- 23 --------- 24
// | __/ | __/ | __/ | __/ |
// | __/ | __/ | __/ | __/ |
// | __/ | __/ | __/ | __/ |
// | / | / | / | / |
// 15 --------- 16 --------- 17 --------- 18 --------- 19
// | __/ | __/ \__ | __/ |
// | __/ | __/ \__ | __/ |
// | __/ | __/ \__ | __/ |
// | / | / \ | / |
// 10 --------- 11 ---------------------- 13 --------- 14
// | __/ | ______// | __/ |
// | __/ | ______/ ___/ | __/ |
// | __/ | ______/ ___/ | __/ |
// | / | / / | / |
// 5 ---------- 6 ---------- 7 ---------- 8 --------- 9
// | __/ | __/ | __/ | __/ |
// | __/ | __/ | __/ | __/ |
// | __/ | __/ | __/ | __/ |
// | / | / | / | / |
// 0 ---------- 1 ---------- 2 --------- 3 --------- 4
//
PopulateMesh<MeshType>( mesh );
std::cout << " ";
std::cout << "Join v of wired edge (possible).";
///NOTE temporary
std::cout <<std::endl;
std::cout <<"NOTE: this test is not performed for the time being.";
std::cout <<"Discussion with Alex regarding this test" <<std::endl;
///NOTE commented out on 07/06/2008
/*joinVertex->SetInput( mesh );
mesh->DeleteFace( mesh->FindEdge( 12, 13 )->GetLeft( ) );
mesh->DeleteFace( mesh->FindEdge( 12, 13 )->GetRight( ) );
if( !joinVertex->Evaluate( mesh->FindEdge( 12, 13 ) ) )
{
std::cout << "FAILED." << std::endl;
return EXIT_FAILURE;
}
mesh->DeletePoint( joinVertex->GetOldPointID( ) );
if( ! AssertTopologicalInvariants< MeshType >
( mesh, 24, 53, 30, 1, 0 ) )
{
std::cout << "FAILED (for [ 12, 13 ] )." << std::endl;
return EXIT_FAILURE;
}
if ( mesh->GetPoint( 13 ).GetValence( ) != 8 )
{
std::cout << "FAILED (for [ 12, 13 ], wrong valence of "
<< mesh->GetPoint( 13 ).GetValence( )
<< " for vertex 13 )." << std::endl;
return EXIT_FAILURE;
}
std::cout << "OK" << std::endl;*/
// Instead of adjacent triangular faces we now consider bigger
// faces. Here is the initial situation:
//
// 20 --------- 21 --------- 22 --------- 23 --------- 24
// | __/ | __/ | __/ | __/ |
// | __/ | __/ | __/ | __/ |
// | __/ | __/ | __/ | __/ |
// | / | / | / | / |
// 15 --------- 16 --------- 17 --------- 18 --------- 19
// | __/ | | | __/ |
// | __/ | | | __/ |
// | __/ | | | __/ |
// | / | | | / |
// 10 --------- 11 12 13 --------- 14
// | __/ | __/ | | __/ |
// | __/ | __/ | | __/ |
// | __/ | __/ | | __/ |
// | / | / | | / |
// 5 ---------- 6 ---------- 7 ---------- 8 --------- 9
// | __/ | __/ | __/ | __/ |
// | __/ | __/ | __/ | __/ |
// | __/ | __/ | __/ | __/ |
// | / | / | / | / |
// 0 ---------- 1 ---------- 2 --------- 3 --------- 4
//
PopulateMesh<MeshType>( mesh );
std::cout << " ";
std::cout << "Join v of internal edge with polygonal Faces (possible).";
joinVertex->SetInput( mesh );
mesh->LightWeightDeleteEdge( mesh->FindEdgeCell( 11, 17 ) );
mesh->LightWeightDeleteEdge( mesh->FindEdgeCell( 11, 12 ) );
mesh->LightWeightDeleteEdge( mesh->FindEdgeCell( 12, 18 ) );
mesh->LightWeightDeleteEdge( mesh->FindEdgeCell( 12, 13 ) );
mesh->LightWeightDeleteEdge( mesh->FindEdgeCell( 7, 13 ) );
mesh->AddFace( mesh->FindEdge( 8, 13 ) );
mesh->AddFace( mesh->FindEdge( 12, 17 ) );
if( !joinVertex->Evaluate( mesh->FindEdge( 12, 17 ) ) )
{
std::cout << "FAILED." << std::endl;
return EXIT_FAILURE;
}
mesh->DeletePoint( joinVertex->GetOldPointID( ) );
// And here is what we should obtain:
//
// 20 --------- 21 --------- 22 --------- 23 --------- 24
// | __/ | __/ | __/ | __/ |
// | __/ | __/ | __/ | __/ |
// | __/ | __/ | __/ | __/ |
// | / | / | / | / |
// 15 --------- 16 --------- 17 --------- 18 --------- 19
// | __/ | / | | __/ |
// | __/ | / | | __/ |
// | __/ | / | | __/ |
// | / | / | | / |
// 10 --------- 11 _/ | 13 --------- 14
// | __/ | / | | __/ |
// | __/ | / | | __/ |
// | __/ | / | | __/ |
// | / | / | | / |
// 5 ---------- 6 ---------- 7 ---------- 8 --------- 9
// | __/ | __/ | __/ | __/ |
// | __/ | __/ | __/ | __/ |
// | __/ | __/ | __/ | __/ |
// | / | / | / | / |
// 0 ---------- 1 ---------- 2 --------- 3 --------- 4
//
if( ! AssertTopologicalInvariants< MeshType >
( mesh, 24, 50, 27, 1, 0 ) )
{
std::cout << "FAILED (for [ 12, 13 ] )." << std::endl;
return EXIT_FAILURE;
}
// Push it one step further: we should obtain
//
// 20 --------- 21 --------- 22 --------- 23 --------- 24
// | __/ | __/ | __/ | __/ |
// | __/ | __/ | __/ | __/ |
// | __/ | __/ | __/ | __/ |
// | / | / | / | / |
// 15 --------- 16 --------- 17 --------- 18 --------- 19
// | __/ | //| \ | __/ |
// | __/ | // | \ | __/ |
// | __/ | / | | \ | __/ |
// | / | / / | \ | / |
// 10 --------- 11 _/ | | \_ 13 --------- 14
// | __/ | / / | \ | __/ |
// | __/ | / | | \ | __/ |
// | __/ | / | | \ | __/ |
// | / | / | | \ | / |
// 5 ---------- 6 / | 8 --------- 9
// | __/ | | | __/ | __/ |
// | __/ | / | __/ | __/ |
// | __/ | | | __/ | __/ |
// | / | / | / | / |
// 0 ---------- 1 ---------- 2 --------- 3 --------- 4
//
mesh->LightWeightDeleteEdge( mesh->FindEdge( 6, 17 ) );
mesh->AddFace( mesh->FindEdge( 7, 17 ) );
if( !joinVertex->Evaluate( mesh->FindEdge( 7, 17 ) ) )
{
std::cout << "FAILED." << std::endl;
return EXIT_FAILURE;
}
mesh->DeletePoint( joinVertex->GetOldPointID( ) );
if( ! AssertTopologicalInvariants< MeshType >
( mesh, 23, 48, 26, 1, 0 ) )
{
std::cout << "FAILED (for [ 12, 13 ] )." << std::endl;
return EXIT_FAILURE;
}
std::cout << ".OK" << std::endl;
// Consider a last pathological test of an edge with an isolated
// end potientaly immersed in a face. Here is the initial situation:
//
// 20 --------- 21 --------- 22 --------- 23 --------- 24
// | __/ | __/ | __/ | __/ |
// | __/ | __/ | __/ | __/ |
// | __/ | __/ | __/ | __/ |
// | / | / | / | / |
// 15 --------- 16 --------- 17 --------- 18 --------- 19
// | __/ | __/ | | __/ |
// | __/ | __/ | | __/ |
// | __/ | __/ | | __/ |
// | / | / | | / |
// 10 --------- 11 12 13 --------- 14
// | __/ | | __/ |
// | __/ | | __/ |
// | __/ | | __/ |
// | / | | / |
// 5 ---------- 6 ---------- 7 ---------- 8 --------- 9
// | __/ | __/ | __/ | __/ |
// | __/ | __/ | __/ | __/ |
// | __/ | __/ | __/ | __/ |
// | / | / | / | / |
// 0 ---------- 1 ---------- 2 --------- 3 --------- 4
//
// Vertices: 25 , Edges: 56, Faces: 32, Boundary = 1, Chi = 1
PopulateMesh<MeshType>( mesh );
std::cout << " ";
std::cout << "Join v of antenna - version 1 (possible).";
joinVertex->SetInput( mesh );
mesh->LightWeightDeleteEdge( mesh->FindEdge( 11, 12 ) );
mesh->LightWeightDeleteEdge( mesh->FindEdge( 6, 12 ) );
mesh->LightWeightDeleteEdge( mesh->FindEdge( 7, 12 ) );
mesh->LightWeightDeleteEdge( mesh->FindEdge( 7, 13 ) );
mesh->LightWeightDeleteEdge( mesh->FindEdge( 12, 13 ) );
mesh->LightWeightDeleteEdge( mesh->FindEdge( 12, 18 ) );
mesh->AddFace( mesh->FindEdge( 7, 8 ) );
if( !joinVertex->Evaluate( mesh->FindEdge( 12, 17 ) ) )
{
std::cout << "FAILED." << std::endl;
return EXIT_FAILURE;
}
mesh->DeletePoint( joinVertex->GetOldPointID( ) );
if( ! AssertTopologicalInvariants< MeshType >
( mesh, 24, 49, 26, 1, 0 ) )
{
std::cout << "FAILED (for antenna - version 1)." << std::endl;
return EXIT_FAILURE;
}
std::cout << "OK" << std::endl;
PopulateMesh<MeshType>( mesh );
std::cout << " ";
std::cout << "Join v of antenna - version 2 (possible).";
joinVertex->SetInput( mesh );
mesh->LightWeightDeleteEdge( mesh->FindEdge( 11, 12 ) );
mesh->LightWeightDeleteEdge( mesh->FindEdge( 6, 12 ) );
mesh->LightWeightDeleteEdge( mesh->FindEdge( 7, 12 ) );
mesh->LightWeightDeleteEdge( mesh->FindEdge( 7, 13 ) );
mesh->LightWeightDeleteEdge( mesh->FindEdge( 12, 13 ) );
mesh->LightWeightDeleteEdge( mesh->FindEdge( 12, 18 ) );
mesh->AddFace( mesh->FindEdge( 7, 8 ) );
if( !joinVertex->Evaluate( mesh->FindEdge( 12, 17 )->GetSym( ) ) )
{
std::cout << "FAILED." << std::endl;
return EXIT_FAILURE;
}
mesh->DeletePoint( joinVertex->GetOldPointID( ) );
if( ! AssertTopologicalInvariants< MeshType >
( mesh, 24, 49, 26, 1, 0 ) )
{
std::cout << "FAILED (for antenna - version 2)." << std::endl;
return EXIT_FAILURE;
}
std::cout << "OK" << std::endl;
std::cout << "Checking JoinVertex." << "OK" << std::endl << std::endl;
return EXIT_SUCCESS;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -