Difference between revisions of "VTK/Examples/Cxx/Meshes/BoundaryEdges"

From KitwarePublic
< VTK‎ | Examples‎ | Cxx
Jump to navigationJump to search
(Replaced content with "= '''See [https://lorensen.github.io/VTKExamples/site/Cxx/Meshes/BoundaryEdges BoundaryEdges] on the new [https://lorensen.github.io/VTKExamples/site/ VTKExamples website]...")
 
(11 intermediate revisions by 2 users not shown)
Line 1: Line 1:
This filter will extract the boundary edges of a mesh. An example file is [http://www.vtk.org/Wiki/Image:Plane.vtp here]. This is a 10x10 grid which forms a plane. The boundary edges are the outside edge of the plane only.
+
= '''See [https://lorensen.github.io/VTKExamples/site/Cxx/Meshes/BoundaryEdges BoundaryEdges] on the new [https://lorensen.github.io/VTKExamples/site/ VTKExamples website].''' =
 
 
==BoundaryEdges.cxx==
 
<source lang="cpp">
 
#include <vtkSmartPointer.h>
 
#include <vtkPolyData.h>
 
#include <vtkXMLPolyDataReader.h>
 
#include <vtkXMLPolyDataWriter.h>
 
#include <vtkFeatureEdges.h>
 
 
 
int main(int argc, char *argv[])
 
{
 
  if(argc != 3)
 
    {
 
    cout << "Required arguments: InputFilename OutputFilename" << endl;
 
    return EXIT_FAILURE;
 
    }
 
 
 
  vtkstd::string inputFilename = argv[1];
 
  vtkstd::string outputFilename = argv[2];
 
 
 
  vtkSmartPointer<vtkXMLPolyDataReader> reader =
 
    vtkSmartPointer<vtkXMLPolyDataReader>::New();
 
  reader->SetFileName(inputFilename.c_str());
 
  reader->Update();
 
 
 
  vtkSmartPointer<vtkFeatureEdges> featureEdges = vtkSmartPointer<vtkFeatureEdges>::New();
 
  featureEdges->SetInput(reader->GetOutput());
 
  featureEdges->BoundaryEdgesOn();
 
  featureEdges->FeatureEdgesOff();
 
  featureEdges->ManifoldEdgesOff();
 
  featureEdges->NonManifoldEdgesOff();
 
 
 
  vtkSmartPointer<vtkXMLPolyDataWriter> writer =
 
    vtkSmartPointer<vtkXMLPolyDataWriter>::New();
 
  writer->SetFileName(outputFilename.c_str());
 
  writer->SetInput(featureEdges->GetOutput());
 
  writer->Write();
 
 
 
  return EXIT_SUCCESS;
 
}
 
 
 
</source>
 
 
 
==CMakeLists.txt
 
<source lang="cmake">
 
cmake_minimum_required(VERSION 2.6)
 
 
 
PROJECT(BoundaryEdges)
 
 
 
FIND_PACKAGE(VTK REQUIRED)
 
INCLUDE(${VTK_USE_FILE})
 
 
 
ADD_EXECUTABLE(BoundaryEdges BoundaryEdges.cxx)
 
TARGET_LINK_LIBRARIES(BoundaryEdges vtkHybrid)
 
 
 
 
 
</source>
 

Latest revision as of 17:42, 27 March 2019