1
/*=========================================================================
3
Program: Insight Segmentation & Registration Toolkit
4
Module: $RCSfile: itkQuadEdgeMeshDeleteEdgeTest.cxx,v $
6
Date: $Date: 2007-12-25 12:57:00 $
7
Version: $Revision: 1.6 $
9
Copyright (c) Insight Software Consortium. All rights reserved.
10
See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details.
12
This software is distributed WITHOUT ANY WARRANTY; without even
13
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
14
PURPOSE. See the above copyright notices for more information.
16
=========================================================================*/
18
#pragma warning ( disable : 4786 )
21
#include "itkQuadEdgeMesh.h"
23
int itkQuadEdgeMeshDeleteEdgeTest( int , char* [] )
25
typedef double PixelType;
26
typedef itk::QuadEdgeMesh< PixelType, 3 > MeshType;
27
std::string indent = " ";
29
MeshType::Pointer mesh = MeshType::New( );
32
MeshType::PointType p0, p1, p2, p3, p4, p5;
33
p0[ 0 ] = 0.00000000000000; p0[ 1 ] = 0.00000000000000; p0[ 2 ] = 5.0;
34
p1[ 0 ] = 0.00000000000000; p1[ 1 ] = 10.00000000000000; p1[ 2 ] = 0.0;
35
p2[ 0 ] = -9.51056516295153; p2[ 1 ] = 3.09016994374947; p2[ 2 ] = 0.0;
36
p3[ 0 ] = -5.87785252292473; p3[ 1 ] = -8.09016994374947; p3[ 2 ] = 0.0;
37
p4[ 0 ] = 5.87785252292473; p4[ 1 ] = -8.09016994374948; p4[ 2 ] = 0.0;
38
p5[ 0 ] = 9.51056516295154; p5[ 1 ] = 3.09016994374947; p5[ 2 ] = 0.0;
40
MeshType::PointIdentifier pid0 = mesh->AddPoint( p0 );
41
MeshType::PointIdentifier pid1 = mesh->AddPoint( p1 );
42
MeshType::PointIdentifier pid2 = mesh->AddPoint( p2 );
43
MeshType::PointIdentifier pid3 = mesh->AddPoint( p3 );
44
MeshType::PointIdentifier pid4 = mesh->AddPoint( p4 );
45
MeshType::PointIdentifier pid5 = mesh->AddPoint( p5 );
47
// Cells in a proper way
48
mesh->AddEdge( pid3, pid4 );
49
mesh->AddEdge( pid4, pid0 );
50
mesh->AddEdge( pid0, pid3 );
51
mesh->AddFaceTriangle( pid3, pid4, pid0 );
53
mesh->AddEdge( pid4, pid5 );
54
mesh->AddEdge( pid5, pid0 );
55
mesh->AddFaceTriangle( pid4, pid5, pid0 );
57
mesh->AddEdge( pid5, pid1 );
58
mesh->AddEdge( pid1, pid0 );
59
mesh->AddFaceTriangle( pid5, pid1, pid0 );
61
mesh->AddEdge( pid1, pid2 );
62
mesh->AddEdge( pid2, pid0 );
63
mesh->AddEdge( pid2, pid3 );
65
int EdgesBefore = mesh->ComputeNumberOfEdges();
67
// Deleting two arbitrary edges:
68
mesh->DeleteEdge( pid3, pid4 );
69
mesh->DeleteEdge( pid0, pid5 );
71
std::cout << indent << "Trying to remove only two edges...";
72
if ( EdgesBefore - mesh->ComputeNumberOfEdges() == 2 )
74
std::cout << "OK." << std::endl;
75
return( EXIT_SUCCESS );
79
std::cout << "FAILED." << std::endl;
80
return( EXIT_FAILURE );
83
return( EXIT_SUCCESS );