VTK/Examples/Cxx/PolyData/CleanPolyData

From KitwarePublic
< VTK‎ | Examples‎ | Cxx
Revision as of 09:23, 2 August 2010 by Zack (talk | contribs) (Reverted edits by Waexu66 (Talk) to last revision by Daviddoria)
Jump to navigationJump to search

CleanPolyData.cxx

#include <vtkSmartPointer.h>
#include <vtkCubeSource.h>
#include <vtkPolyData.h>
#include <vtkCleanPolyData.h>

int main(int, char *[])
{
  vtkSmartPointer<vtkCubeSource> cubeSource = 
    vtkSmartPointer<vtkCubeSource>::New();
  cubeSource->Update();
  
  std::cout << "Input cube has " << cubeSource->GetOutput()->GetNumberOfPoints() 
    << " vertices." << std::endl;
    
  vtkSmartPointer<vtkCleanPolyData> cleanPolyData = 
      vtkSmartPointer<vtkCleanPolyData>::New();
  cleanPolyData->SetInputConnection(cubeSource->GetOutputPort());
  cleanPolyData->Update();
  
  std::cout << "Cleaned cube has " << cleanPolyData->GetOutput()->GetNumberOfPoints() 
    << " vertices." << std::endl;
  
  return EXIT_SUCCESS;
}

CMakeLists.txt

cmake_minimum_required(VERSION 2.6)
PROJECT(CleanPolyData)

FIND_PACKAGE(VTK REQUIRED)
INCLUDE(${VTK_USE_FILE})

ADD_EXECUTABLE(CleanPolyData CleanPolyData.cxx)
TARGET_LINK_LIBRARIES(CleanPolyData vtkHybrid)