VTK/Examples/Cxx/IO/SimplePointsWriter

From KitwarePublic

Jump to: navigation, search

SimplePointsWriter.cxx

#include <vtkPolyData.h>
#include <vtkSimplePointsWriter.h>
#include <vtkSphereSource.h>
#include <vtkSmartPointer.h>
 
int main(int argc, char *argv[])
{
  vtkSmartPointer<vtkSphereSource> sphereSource =
    vtkSmartPointer<vtkSphereSource>::New();
  sphereSource->Update();
 
  vtkSmartPointer<vtkSimplePointsWriter> writer =
    vtkSmartPointer<vtkSimplePointsWriter>::New();
  writer->SetFileName("test.xyz");
  writer->SetInputConnection(sphereSource->GetOutputPort());
  writer->Write();
 
  return EXIT_SUCCESS;
}

CMakeLists.txt

cmake_minimum_required(VERSION 2.8)
 
PROJECT(SimplePointsWriter)
 
find_package(VTK REQUIRED)
include(${VTK_USE_FILE})
 
if (APPLE)
  add_executable(SimplePointsWriter MACOSX_BUNDLE SimplePointsWriter.cxx)
else()
  add_executable(SimplePointsWriter SimplePointsWriter.cxx)
endif()
 
if(VTK_LIBRARIES)
  target_link_libraries(SimplePointsWriter ${VTK_LIBRARIES})
else()
  target_link_libraries(SimplePointsWriter vtkHybrid )
endif()
Personal tools