VTK/Examples/Cxx/Boneyard/GeometricObjects/WriteFile/Point

From KitwarePublic
< VTK‎ | Examples‎ | Cxx
Jump to navigationJump to search


This example creates a list of points of length 1. It then retrieves the point.

Point.cxx

#include <vtkSmartPointer.h>
#include <vtkPoints.h>

int main(int, char *[])
{
  //create a list of points
  vtkSmartPointer<vtkPoints> points = 
    vtkSmartPointer<vtkPoints>::New();
  
  //add a point to the list
  const float p[3] = {1.0, 2.0, 3.0};
  points->InsertNextPoint(p);
  
  //retrieve the point
  double* pout = points->GetPoint(0);
  cout << pout[0] << " " << pout[1] << " " << pout[2] << endl;
  
  return EXIT_SUCCESS;
}

CMakeLists.txt

cmake_minimum_required(VERSION 2.6)

PROJECT(Point)

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

ADD_EXECUTABLE(Point Point.cxx)
TARGET_LINK_LIBRARIES(Point vtkHybrid)