~ubuntu-branches/ubuntu/precise/insighttoolkit/precise

« back to all changes in this revision

Viewing changes to Testing/Code/Review/itkQuadEdgeMeshDeleteEdgeTest.cxx

  • Committer: Bazaar Package Importer
  • Author(s): Steve M. Robbins
  • Date: 2008-12-19 20:16:49 UTC
  • mfrom: (1.2.1 upstream) (4.1.1 sid)
  • Revision ID: james.westby@ubuntu.com-20081219201649-drt97guwl2ryt0cn

* New upstream version.
  - patches/nifti-versioning.patch: Remove.  Applied upstream.
  - control:
  - rules: Update version numbers, package names.

* control: Build-depend on uuid-dev (gdcm uses it).

* copyright: Update download URL.

* rules: Adhere to parallel=N in DEB_BUILD_OPTIONS by setting MAKEFLAGS.

* compat: Set to 7.
* control: Update build-dep on debhelper to version >= 7.

* CMakeCache.txt.debian: Set CMAKE_BUILD_TYPE to "RELEASE" so that we
  build with -O3 (not -O2), necessary to optimize the templated code.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*=========================================================================
 
2
 
 
3
  Program:   Insight Segmentation & Registration Toolkit
 
4
  Module:    $RCSfile: itkQuadEdgeMeshDeleteEdgeTest.cxx,v $
 
5
  Language:  C++
 
6
  Date:      $Date: 2007-12-25 12:57:00 $
 
7
  Version:   $Revision: 1.6 $
 
8
 
 
9
  Copyright (c) Insight Software Consortium. All rights reserved.
 
10
  See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details.
 
11
 
 
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.
 
15
 
 
16
=========================================================================*/
 
17
#if defined(_MSC_VER)
 
18
#pragma warning ( disable : 4786 )
 
19
#endif
 
20
 
 
21
#include "itkQuadEdgeMesh.h"
 
22
 
 
23
int itkQuadEdgeMeshDeleteEdgeTest( int , char* [] )
 
24
{
 
25
  typedef double                            PixelType;
 
26
  typedef itk::QuadEdgeMesh< PixelType, 3 > MeshType;
 
27
  std::string indent = "    ";
 
28
    
 
29
  MeshType::Pointer mesh = MeshType::New( );
 
30
 
 
31
  // Points
 
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;
 
39
 
 
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 );
 
46
 
 
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 );
 
52
 
 
53
  mesh->AddEdge( pid4, pid5 );
 
54
  mesh->AddEdge( pid5, pid0 );
 
55
  mesh->AddFaceTriangle( pid4, pid5, pid0 );
 
56
 
 
57
  mesh->AddEdge( pid5, pid1 );
 
58
  mesh->AddEdge( pid1, pid0 );
 
59
  mesh->AddFaceTriangle( pid5, pid1, pid0 );
 
60
 
 
61
  mesh->AddEdge( pid1, pid2 );
 
62
  mesh->AddEdge( pid2, pid0 );
 
63
  mesh->AddEdge( pid2, pid3 );
 
64
 
 
65
  int EdgesBefore = mesh->ComputeNumberOfEdges();
 
66
 
 
67
  // Deleting two arbitrary edges: 
 
68
  mesh->DeleteEdge( pid3, pid4 );
 
69
  mesh->DeleteEdge( pid0, pid5 );
 
70
 
 
71
  std::cout << indent << "Trying to remove only two edges...";
 
72
  if ( EdgesBefore - mesh->ComputeNumberOfEdges() == 2 )
 
73
    {
 
74
    std::cout << "OK." << std::endl;
 
75
    return( EXIT_SUCCESS );
 
76
    }
 
77
  else
 
78
    {
 
79
    std::cout << "FAILED." << std::endl;
 
80
    return( EXIT_FAILURE );
 
81
    }
 
82
 
 
83
  return( EXIT_SUCCESS );
 
84
}